Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from huggingface_hub import
|
| 3 |
|
| 4 |
# 初始化 Inference API 客戶端
|
| 5 |
model_id = "dingckc/FineLlama-3.1-8B"
|
| 6 |
api_token = "hf_rhrXnUPYwsSCgmhidDnEXNXOkELWHLTr"
|
| 7 |
-
inference =
|
| 8 |
|
| 9 |
# 定義推理函數
|
| 10 |
def evaluate_essay(title, essay):
|
|
@@ -18,9 +18,9 @@ def evaluate_essay(title, essay):
|
|
| 18 |
return response.get("generated_text", "No evaluation available.")
|
| 19 |
|
| 20 |
# 使用 Gradio 構建界面
|
| 21 |
-
title_input = gr.
|
| 22 |
-
essay_input = gr.
|
| 23 |
-
output_text = gr.
|
| 24 |
|
| 25 |
gr.Interface(
|
| 26 |
fn=evaluate_essay,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
# 初始化 Inference API 客戶端
|
| 5 |
model_id = "dingckc/FineLlama-3.1-8B"
|
| 6 |
api_token = "hf_rhrXnUPYwsSCgmhidDnEXNXOkELWHLTr"
|
| 7 |
+
inference = InferenceClient(model=model_id, token=api_token)
|
| 8 |
|
| 9 |
# 定義推理函數
|
| 10 |
def evaluate_essay(title, essay):
|
|
|
|
| 18 |
return response.get("generated_text", "No evaluation available.")
|
| 19 |
|
| 20 |
# 使用 Gradio 構建界面
|
| 21 |
+
title_input = gr.Textbox(label="Essay Title")
|
| 22 |
+
essay_input = gr.Textbox(label="Essay Content", lines=10)
|
| 23 |
+
output_text = gr.Textbox(label="Evaluation Result")
|
| 24 |
|
| 25 |
gr.Interface(
|
| 26 |
fn=evaluate_essay,
|