Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -18,18 +18,20 @@ tokenizer.set_chat_template(tokenizer.chat_template)
|
|
18 |
|
19 |
|
20 |
def generate_response(prompt):
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
# 建立 Gradio 介面
|
25 |
demo = gr.Interface(
|
26 |
fn=generate_response,
|
27 |
inputs=gr.Textbox(lines=5, label="輸入提示 (Prompt)"),
|
28 |
outputs=[
|
|
|
29 |
gr.Textbox(label="回應")
|
30 |
],
|
31 |
-
title="Qwen3-0.6B
|
32 |
-
description="基於
|
33 |
)
|
34 |
|
35 |
if __name__ == "__main__":
|
|
|
18 |
|
19 |
|
20 |
def generate_response(prompt):
|
21 |
+
output = pipe.generate([prompt], max_length=1024)
|
22 |
+
tokenpersec=output.perf_metrics.get_throughput().mean:.2f
|
23 |
+
return tokenpersec,output
|
24 |
|
25 |
# 建立 Gradio 介面
|
26 |
demo = gr.Interface(
|
27 |
fn=generate_response,
|
28 |
inputs=gr.Textbox(lines=5, label="輸入提示 (Prompt)"),
|
29 |
outputs=[
|
30 |
+
gr.Textbox(label="tokens/sec"),
|
31 |
gr.Textbox(label="回應")
|
32 |
],
|
33 |
+
title="Qwen3-0.6B-int4-ov ",
|
34 |
+
description="基於 Qwen3-0.6B-int4-ov 推理應用,支援思考過程分離與 GUI。"
|
35 |
)
|
36 |
|
37 |
if __name__ == "__main__":
|