dingckc commited on
Commit
0fef5af
·
verified ·
1 Parent(s): 1d5cda4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1,10 +1,10 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceApi
3
 
4
  # 初始化 Inference API 客戶端
5
  model_id = "dingckc/FineLlama-3.1-8B"
6
  api_token = "hf_rhrXnUPYwsSCgmhidDnEXNXOkELWHLTr"
7
- inference = InferenceApi(repo_id=model_id, token=api_token, task="text-generation")
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.inputs.Textbox(label="Essay Title")
22
- essay_input = gr.inputs.Textbox(label="Essay Content", lines=10)
23
- output_text = gr.outputs.Textbox(label="Evaluation Result")
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,