Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ try:
|
|
| 43 |
|
| 44 |
if hf_token:
|
| 45 |
client = InferenceClient(api_key=hf_token)
|
| 46 |
-
print(f"✅ Hugging Face client initialized with Qwen/Qwen2.5-72B-Instruct model")
|
| 47 |
print(f" Using authenticated access (HF_TOKEN detected)")
|
| 48 |
else:
|
| 49 |
# 如果没有 token,使用无认证模式(免费层,有速率限制)
|
|
@@ -682,7 +682,7 @@ You can handle any financial question - from simple data queries to complex mult
|
|
| 682 |
|
| 683 |
response = client.chat_completion(
|
| 684 |
messages=messages,
|
| 685 |
-
model="Qwen/Qwen2.5-72B-Instruct", #
|
| 686 |
tools=MCP_TOOLS,
|
| 687 |
max_tokens=3000,
|
| 688 |
temperature=0.7,
|
|
@@ -748,7 +748,7 @@ You can handle any financial question - from simple data queries to complex mult
|
|
| 748 |
try:
|
| 749 |
response = client.chat_completion(
|
| 750 |
messages=messages,
|
| 751 |
-
model="Qwen/Qwen2.5-72B-Instruct",
|
| 752 |
max_tokens=3000,
|
| 753 |
temperature=0.7
|
| 754 |
)
|
|
@@ -763,7 +763,7 @@ You can handle any financial question - from simple data queries to complex mult
|
|
| 763 |
final_response = ""
|
| 764 |
|
| 765 |
# 显示调试信息:使用的模型
|
| 766 |
-
final_response += f"<div style='padding: 8px; background: #e3f2fd; border-left: 3px solid #2196f3; margin-bottom: 10px; font-size: 0.9em;'>🤖 <strong>Model:</strong> Qwen/Qwen2.5-72B-Instruct | <strong>Iterations:</strong> {iteration}</div>\n\n"
|
| 767 |
|
| 768 |
# 如果有工具调用,显示调用日志
|
| 769 |
if tool_calls_log:
|
|
@@ -847,7 +847,7 @@ with gr.Blocks(title="SEC Financial Data Query Assistant") as demo:
|
|
| 847 |
# 显示 AI 功能说明
|
| 848 |
gr.Markdown("""
|
| 849 |
<div style='padding: 15px; background: #d4edda; border-left: 4px solid #28a745; margin: 10px 0; border-radius: 4px;'>
|
| 850 |
-
<strong>✅ AI Assistant Enabled:</strong> Powered by Qwen/Qwen2.5-72B-Instruct
|
| 851 |
<br>
|
| 852 |
<strong>💬 Ask me anything:</strong> I can understand natural language and automatically fetch financial data when needed!
|
| 853 |
</div>
|
|
|
|
| 43 |
|
| 44 |
if hf_token:
|
| 45 |
client = InferenceClient(api_key=hf_token)
|
| 46 |
+
print(f"✅ Hugging Face client initialized with Qwen/Qwen2.5-72B-Instruct:novita model")
|
| 47 |
print(f" Using authenticated access (HF_TOKEN detected)")
|
| 48 |
else:
|
| 49 |
# 如果没有 token,使用无认证模式(免费层,有速率限制)
|
|
|
|
| 682 |
|
| 683 |
response = client.chat_completion(
|
| 684 |
messages=messages,
|
| 685 |
+
model="Qwen/Qwen2.5-72B-Instruct:novita", # 使用 novita provider,更稳定
|
| 686 |
tools=MCP_TOOLS,
|
| 687 |
max_tokens=3000,
|
| 688 |
temperature=0.7,
|
|
|
|
| 748 |
try:
|
| 749 |
response = client.chat_completion(
|
| 750 |
messages=messages,
|
| 751 |
+
model="Qwen/Qwen2.5-72B-Instruct:novita",
|
| 752 |
max_tokens=3000,
|
| 753 |
temperature=0.7
|
| 754 |
)
|
|
|
|
| 763 |
final_response = ""
|
| 764 |
|
| 765 |
# 显示调试信息:使用的模型
|
| 766 |
+
final_response += f"<div style='padding: 8px; background: #e3f2fd; border-left: 3px solid #2196f3; margin-bottom: 10px; font-size: 0.9em;'>🤖 <strong>Model:</strong> Qwen/Qwen2.5-72B-Instruct:novita | <strong>Iterations:</strong> {iteration}</div>\n\n"
|
| 767 |
|
| 768 |
# 如果有工具调用,显示调用日志
|
| 769 |
if tool_calls_log:
|
|
|
|
| 847 |
# 显示 AI 功能说明
|
| 848 |
gr.Markdown("""
|
| 849 |
<div style='padding: 15px; background: #d4edda; border-left: 4px solid #28a745; margin: 10px 0; border-radius: 4px;'>
|
| 850 |
+
<strong>✅ AI Assistant Enabled:</strong> Powered by Qwen/Qwen2.5-72B-Instruct:novita with automatic MCP tool calling.
|
| 851 |
<br>
|
| 852 |
<strong>💬 Ask me anything:</strong> I can understand natural language and automatically fetch financial data when needed!
|
| 853 |
</div>
|