hsuwill000 commited on
Commit
b260b39
·
verified ·
1 Parent(s): 0c88b92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -24,7 +24,8 @@ def generate_response(prompt):
24
  def streamer(subword):
25
  nonlocal full_response
26
  full_response += subword
27
- return full_response # 返回更新後的完整回應
 
28
 
29
  try:
30
  # 使用流式生成
@@ -42,7 +43,7 @@ demo = gr.Interface(
42
  inputs=gr.Textbox(lines=5, label="輸入提示 (Prompt)"),
43
  outputs=[
44
  gr.Textbox(label="tokens/sec"),
45
- gr.Textbox(label="回應")
46
  ],
47
  title="Qwen3-0.6B-int4-ov ",
48
  description="基於 Qwen3-0.6B-int4-ov 推理應用,支援思考過程分離與 GUI。"
 
24
  def streamer(subword):
25
  nonlocal full_response
26
  full_response += subword
27
+ yield full_response # 使用 yield 使 streamer 成為生成器
28
+ return ov_genai.StreamingStatus.RUNNING # 返回 StreamingStatus.RUNNING
29
 
30
  try:
31
  # 使用流式生成
 
43
  inputs=gr.Textbox(lines=5, label="輸入提示 (Prompt)"),
44
  outputs=[
45
  gr.Textbox(label="tokens/sec"),
46
+ gr.Textbox(label="回應"]
47
  ],
48
  title="Qwen3-0.6B-int4-ov ",
49
  description="基於 Qwen3-0.6B-int4-ov 推理應用,支援思考過程分離與 GUI。"