Spaces:
Runtime error
Runtime error
fix: config error
Browse files
app.py
CHANGED
@@ -2,13 +2,10 @@ import os
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import gradio as gr
|
4 |
import re
|
5 |
-
import sys
|
6 |
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
7 |
-
from config.config import *
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
client = InferenceClient(model=hugging_face_model_path, token=HUGGING_FACE_TOKEN)
|
12 |
|
13 |
def split_and_generate(modern_text):
|
14 |
# Split the input text into sentences for the model is trained on sentence pairs
|
@@ -25,6 +22,6 @@ demo = gr.Interface(fn=split_and_generate,
|
|
25 |
inputs=[gr.Textbox(label="现代文", lines=10)],
|
26 |
outputs=[gr.Textbox(label="古文", lines=10)],
|
27 |
title="现代文转古文大模型",
|
28 |
-
description="请在左边对话框输入你要转换的现代文并点击“Submit
|
29 |
)
|
30 |
-
demo.launch()
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import gradio as gr
|
4 |
import re
|
|
|
|
|
|
|
5 |
|
6 |
+
hugging_face_model_path = "cofeg/Finetuned-Xunzi-Qwen2-1.5B-for-ancient-text-generation"
|
7 |
+
|
8 |
+
client = InferenceClient(model=hugging_face_model_path, token=os.getenv('HUGGING_FACE_TOKEN'))
|
9 |
|
10 |
def split_and_generate(modern_text):
|
11 |
# Split the input text into sentences for the model is trained on sentence pairs
|
|
|
22 |
inputs=[gr.Textbox(label="现代文", lines=10)],
|
23 |
outputs=[gr.Textbox(label="古文", lines=10)],
|
24 |
title="现代文转古文大模型",
|
25 |
+
description="请在左边对话框输入你要转换的现代文并点击“Submit”按钮,耐心等待一两分钟,右边的对话框将显示转换后的古文。<br>由于训练数据来源于《徐霞客游记》,故对游记类文字转换效果较好。"
|
26 |
)
|
27 |
+
demo.launch()
|