Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,8 @@ import time
|
|
6 |
|
7 |
import huggingface_hub as hf_hub
|
8 |
# 初始化 OpenVINO 模型
|
9 |
-
model_id = "
|
10 |
model_path = "ov"
|
11 |
-
#model_id = "OpenVINO/Phi-4-mini-instruct-int4-ov"
|
12 |
-
#model_path = "Phi-4-mini-instruct-int4-ov"
|
13 |
-
|
14 |
|
15 |
|
16 |
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
@@ -30,7 +27,12 @@ def finish_chat():
|
|
30 |
|
31 |
# 建立推論函式:使用 streamer 並回傳 generator 結果
|
32 |
def generate_stream(prompt):
|
33 |
-
prompt = prompt
|
|
|
|
|
|
|
|
|
|
|
34 |
q = queue.Queue()
|
35 |
tps_result = ""
|
36 |
def streamer(subword):
|
|
|
6 |
|
7 |
import huggingface_hub as hf_hub
|
8 |
# 初始化 OpenVINO 模型
|
9 |
+
model_id = "OpenVINO/Qwen2-0.5B-int4-ov"
|
10 |
model_path = "ov"
|
|
|
|
|
|
|
11 |
|
12 |
|
13 |
hf_hub.snapshot_download(model_id, local_dir=model_path)
|
|
|
27 |
|
28 |
# 建立推論函式:使用 streamer 並回傳 generator 結果
|
29 |
def generate_stream(prompt):
|
30 |
+
prompt = prompt #+ " /no_think" + " 答案短且明瞭"
|
31 |
+
chat = [
|
32 |
+
{"role": "user", "content": "{prompt}"},
|
33 |
+
]
|
34 |
+
prompt = tokenizer.apply_chat_template(chat)
|
35 |
+
|
36 |
q = queue.Queue()
|
37 |
tps_result = ""
|
38 |
def streamer(subword):
|