Spaces:
Sleeping
Sleeping
Remove certain fields
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
from dotenv import load_dotenv
|
|
|
|
| 3 |
|
| 4 |
import json
|
| 5 |
import pandas as pd
|
|
@@ -15,7 +16,7 @@ import re
|
|
| 15 |
|
| 16 |
import logging
|
| 17 |
|
| 18 |
-
|
| 19 |
HF_API_KEY = os.getenv("HF_API_KEY")
|
| 20 |
|
| 21 |
# Configure logging to write to 'zaoju_logs.log' without using pickle
|
|
@@ -361,7 +362,7 @@ def deepseek_extract_contract_summary(json_data, save_json=False, json_filename=
|
|
| 361 |
filtered_contract_data = {key: value for key, value in contract_data.items() if "long_table" not in key}
|
| 362 |
|
| 363 |
# Step 3: Convert back to JSON string (if needed)
|
| 364 |
-
json_output = json.dumps(
|
| 365 |
|
| 366 |
prompt = """You are given a contract in JSON format. Extract the following information:
|
| 367 |
|
|
@@ -370,15 +371,13 @@ Return the extracted information as a structured JSON in the exact format shown
|
|
| 370 |
|
| 371 |
{
|
| 372 |
"合同编号":
|
| 373 |
-
"采购经办人": (注意:不是买家必须是采购经办人,不是一个公司而是一个人)
|
| 374 |
"接收人": (注意:不是买家必须是接收人,不是一个公司而是一个人)
|
| 375 |
"Recipient":
|
| 376 |
-
"接收地":
|
| 377 |
-
"Place of receipt":
|
| 378 |
"供应商":
|
| 379 |
"币种": (主要用的货币,填英文缩写。GNF一般是为了方便而转换出来的, 除非只有GNF,GNF一般不是主要币种。)
|
| 380 |
-
"
|
| 381 |
-
"供货日期": 必须是一个日期,而不是天数
|
| 382 |
}
|
| 383 |
|
| 384 |
Contract data in JSON format:""" + f"""
|
|
|
|
| 1 |
import os
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
+
load_dotenv()
|
| 4 |
|
| 5 |
import json
|
| 6 |
import pandas as pd
|
|
|
|
| 16 |
|
| 17 |
import logging
|
| 18 |
|
| 19 |
+
|
| 20 |
HF_API_KEY = os.getenv("HF_API_KEY")
|
| 21 |
|
| 22 |
# Configure logging to write to 'zaoju_logs.log' without using pickle
|
|
|
|
| 362 |
filtered_contract_data = {key: value for key, value in contract_data.items() if "long_table" not in key}
|
| 363 |
|
| 364 |
# Step 3: Convert back to JSON string (if needed)
|
| 365 |
+
json_output = json.dumps(filtered_contract_data, ensure_ascii=False, indent=4)
|
| 366 |
|
| 367 |
prompt = """You are given a contract in JSON format. Extract the following information:
|
| 368 |
|
|
|
|
| 371 |
|
| 372 |
{
|
| 373 |
"合同编号":
|
|
|
|
| 374 |
"接收人": (注意:不是买家必须是接收人,不是一个公司而是一个人)
|
| 375 |
"Recipient":
|
| 376 |
+
"接收地": (注意:不是交货地点是目的港,只写中文,英文写在 place of receipt)
|
| 377 |
+
"Place of receipt": (只写英文, 如果接收地/目的港/Port of destination 有英文可填在这里)
|
| 378 |
"供应商":
|
| 379 |
"币种": (主要用的货币,填英文缩写。GNF一般是为了方便而转换出来的, 除非只有GNF,GNF一般不是主要币种。)
|
| 380 |
+
"供货日期": (如果合同里有写才填,不要自己推理出日期,必须是一个日期,而不是天数)
|
|
|
|
| 381 |
}
|
| 382 |
|
| 383 |
Contract data in JSON format:""" + f"""
|