fix
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ from peft import PeftModel
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
|
| 8 |
-
from transformers import AutoModel
|
| 9 |
from transformers.generation.utils import GenerationConfig
|
| 10 |
# 获取HF token(Spaces会自动提供)
|
| 11 |
hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
|
@@ -22,7 +22,7 @@ try:
|
|
| 22 |
|
| 23 |
# Load model directly
|
| 24 |
model = AutoModel.from_pretrained("Go4miii/DISC-FinLLM", trust_remote_code=True, dtype="auto")
|
| 25 |
-
|
| 26 |
|
| 27 |
except Exception as e:
|
| 28 |
print("\n" + "=" * 50)
|
|
@@ -109,15 +109,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 109 |
|
| 110 |
gr.Examples(
|
| 111 |
examples=[
|
| 112 |
-
"
|
| 113 |
-
"According to Gran, the company has no plans to move all production to Russia, although that is where the company is growing.",
|
| 114 |
-
"Apple Inc. reported record quarterly revenue of $123.9 billion, up 11% year over year, and quarterly earnings per diluted share of $2.10.",
|
| 115 |
-
"The Federal Reserve announced a 0.75 percentage point interest rate increase, the largest since 1994, to combat rising inflation.",
|
| 116 |
-
"Tesla shares tumbled 12% after the company missed delivery expectations for the third consecutive quarter.",
|
| 117 |
-
"Microsoft and OpenAI announced a multi-year partnership to develop advanced AI technologies, with Microsoft investing $10 billion.",
|
| 118 |
],
|
| 119 |
inputs=news_input,
|
| 120 |
-
label="📋
|
| 121 |
)
|
| 122 |
|
| 123 |
# 事件处理
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
|
| 8 |
+
from transformers import AutoModel, AutoTokenizer
|
| 9 |
from transformers.generation.utils import GenerationConfig
|
| 10 |
# 获取HF token(Spaces会自动提供)
|
| 11 |
hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
|
|
|
| 22 |
|
| 23 |
# Load model directly
|
| 24 |
model = AutoModel.from_pretrained("Go4miii/DISC-FinLLM", trust_remote_code=True, dtype="auto")
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained("Go4miii/DISC-FinLLM", use_fast=False, trust_remote_code=True)
|
| 26 |
|
| 27 |
except Exception as e:
|
| 28 |
print("\n" + "=" * 50)
|
|
|
|
| 109 |
|
| 110 |
gr.Examples(
|
| 111 |
examples=[
|
| 112 |
+
"什么是不良资产",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
],
|
| 114 |
inputs=news_input,
|
| 115 |
+
label="📋 示例"
|
| 116 |
)
|
| 117 |
|
| 118 |
# 事件处理
|