ソースを参照

Merge branch 'master' of http://114.244.114.158:8802/siwei/siwei_ai

gushoubang 8 ヶ月 前
コミット
a91acc8a71
4 ファイル変更16 行追加69 行削除
  1. 0 7
      1.py
  2. 16 7
      app.py
  3. 0 45
      ceshi.py
  4. 0 10
      ollama_qwen2.py

+ 0 - 7
1.py

@@ -1,7 +0,0 @@
-import torch
-
-print(torch.__version__) # 查看torch当前版本号
-
-print(torch.version.cuda) # 编译当前版本的torch使用的cuda版本号
-
-print(torch.cuda.is_available()) # 查看当前cuda是否可用于当前版本的Torch,如果输出True,则表示可用

+ 16 - 7
app.py

@@ -1,4 +1,5 @@
 from flask import Flask, render_template, request, jsonify
+from flask_cors import CORS
 import psycopg2
 from psycopg2.extras import DictCursor
 import logging
@@ -8,6 +9,7 @@ import datetime
 import uuid
 
 app = Flask(__name__)
+CORS(app)
 
 
 # 配置日志
@@ -58,7 +60,7 @@ def inputMsg():
 
     # 生成提示信息
     prompt = f"""请扮演文本提取工具,把这句话:"{msg}",基于以下因子选择、选址范围和用地类型提取其对应的相关数据,提取结果请严格将json格式字符串输出并保障寄送格式正确无误,
-    选址范围 = ['抱坡区','天涯区','崖州区','海棠区','吉阳区',"青浦区","静安区","浦东新区","松江区','海淀区', '昌平区', '朝阳区' ],
+    选址范围 = ['抱坡区','天涯区','崖州区','海棠区','吉阳区'],
     因子选择 = [
         "高程",
         "坡度",
@@ -101,7 +103,7 @@ def inputMsg():
     area是用地大小,单位统一转换为亩
     factors.type是因子选择
     其他公里、千米的单位转换为米
-    输出的json格式数据如下:
+    默认输出的json格式数据如下:
     {{
         "districtName": "抱坡区",
         "landType": "耕地",
@@ -117,11 +119,13 @@ def inputMsg():
             }},
             {{
                 "type": "永久基本农田",
-                "condition": "不相交"
+                "condition": "不相交",
+                "value": "0"
             }},
             {{
                 "type": "城镇开发边界内",
-                "condition": "包含"
+                "condition": "包含",
+                "value": "0"
             }},
             {{
                 "type": "医疗卫生设施",
@@ -136,6 +140,7 @@ def inputMsg():
     try:
         res = ollama.generate(
             model="qwen2:7b",
+            # model="gemma2:27b",
             stream=False,
             prompt=prompt,
             options={"temperature": 0},
@@ -175,7 +180,7 @@ def jsonResToDict(json_res):
     formatted_time = now.strftime("%Y%m%d%H%M%S")
     res = {
         "xzmj": 1500,
-        "xmmc": "规划选址项目_"+formatted_time,
+        "xmmc": "聊天选址项目_"+formatted_time,
         "jsdw": "建设单位",
         "ydxz_bsm": landType,
         "ydmjbegin": json_res["area"]["min"],
@@ -222,7 +227,7 @@ def jsonResToDict(json_res):
                 "spatial_type": conditionObj["spatial_type"],
                 "default": factor["condition"],
                 "hasValue": conditionObj["hasValue"],
-                "defaultValue": factor["value"],
+                "defaultValue": str(factor["value"]),
                 "unit": conditionObj["unit"],
                 "clip": conditionObj["clip"]
             }
@@ -236,7 +241,11 @@ def jsonResToDict(json_res):
         else:
             factorTemplate["conditionInfo"]=json.loads(factorTemplate["conditionInfo"])
             res["yxyz"].append(factorTemplate)
-    return res
+    resObj={}
+    resObj["data"]=res
+    resObj["code"]=200
+    resObj["type"]="selectLand"
+    return resObj
 
 # 获取因子信息
 

ファイルの差分が大きいため隠しています
+ 0 - 45
ceshi.py


ファイルの差分が大きいため隠しています
+ 0 - 10
ollama_qwen2.py


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません