hsuwill000 commited on
Commit
fbf99b8
·
verified ·
1 Parent(s): b29f69c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -34,6 +34,11 @@ for i, url in enumerate(urls):
34
  #with open(f"./data/doc_{i}.txt", "w", encoding="utf-8") as f:
35
  # f.write(text)
36
 
 
 
 
 
 
37
  # 初始化 OpenVINO 模型
38
  model_id = "hsuwill000/MiniCPM3-4B_int4_ov"
39
  #model_id = "OpenVINO/Qwen3-0.6B-int4-ov"
@@ -118,9 +123,12 @@ with gr.Blocks() as demo:
118
  status_box = gr.Textbox(label="狀態", interactive=False)
119
  TPS_box = gr.Textbox(label="TPS", interactive=False)
120
  with gr.Row():
121
- textbox_input = gr.Textbox(label="Prompt", lines=1, placeholder="Enter prompt here...")
122
- button = gr.Button("Submit")
123
-
 
 
 
124
  textbox_output = gr.Markdown(label="robot answer:", elem_id="scroll_output")
125
 
126
  start_btn.click(fn=start_chat, outputs=status_box)
 
34
  #with open(f"./data/doc_{i}.txt", "w", encoding="utf-8") as f:
35
  # f.write(text)
36
 
37
+
38
+ response = requests.get(urls[0])
39
+ response.encoding = 'utf-8' # 強制設為 UTF-8 編碼
40
+ story_default_text = response.text.strip()
41
+
42
  # 初始化 OpenVINO 模型
43
  model_id = "hsuwill000/MiniCPM3-4B_int4_ov"
44
  #model_id = "OpenVINO/Qwen3-0.6B-int4-ov"
 
123
  status_box = gr.Textbox(label="狀態", interactive=False)
124
  TPS_box = gr.Textbox(label="TPS", interactive=False)
125
  with gr.Row():
126
+ with gr.Column():
127
+ textbox_input = gr.Textbox(label="Prompt", lines=1, placeholder="Enter prompt here...")
128
+ button = gr.Button("Submit")
129
+ with gr.Column():
130
+ StoryBox = gr.Textbox(label="Story", lines=50, placeholder="Story here...", value=story_default_text)
131
+
132
  textbox_output = gr.Markdown(label="robot answer:", elem_id="scroll_output")
133
 
134
  start_btn.click(fn=start_chat, outputs=status_box)