Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,12 @@ import os
|
|
4 |
import subprocess
|
5 |
|
6 |
# 模型下载链接
|
7 |
-
model_url = "https://huggingface.co/CMLL/ZhongJing-2-1_8b-GGUF/resolve/main/ZhongJing1_5-1_8b-
|
8 |
|
9 |
# 下载模型函数
|
10 |
def download_model(url, model_dir="models"):
|
11 |
os.makedirs(model_dir, exist_ok=True)
|
12 |
-
model_path = hf_hub_download(repo_id="CMLL/ZhongJing-2-1_8b-GGUF", filename="ZhongJing1_5-1_8b-
|
13 |
return model_path
|
14 |
|
15 |
# 安装环境函数
|
@@ -34,7 +34,7 @@ def chat_with_model(user_input, history):
|
|
34 |
f.write(prompt + "\n")
|
35 |
|
36 |
# 执行命令并捕获输出
|
37 |
-
command = f"./llama.cpp/build/bin/main -m models/ZhongJing1_5-1_8b-
|
38 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
39 |
|
40 |
# 解析输出
|
|
|
4 |
import subprocess
|
5 |
|
6 |
# 模型下载链接
|
7 |
+
model_url = "https://huggingface.co/CMLL/ZhongJing-2-1_8b-GGUF/resolve/main/ZhongJing1_5-1_8b-q4_0.gguf"
|
8 |
|
9 |
# 下载模型函数
|
10 |
def download_model(url, model_dir="models"):
|
11 |
os.makedirs(model_dir, exist_ok=True)
|
12 |
+
model_path = hf_hub_download(repo_id="CMLL/ZhongJing-2-1_8b-GGUF", filename="ZhongJing1_5-1_8b-q4_0.gguf", local_dir=model_dir)
|
13 |
return model_path
|
14 |
|
15 |
# 安装环境函数
|
|
|
34 |
f.write(prompt + "\n")
|
35 |
|
36 |
# 执行命令并捕获输出
|
37 |
+
command = f"./llama.cpp/build/bin/main -m models/ZhongJing1_5-1_8b-q4_0.gguf -n 256 --repeat_penalty 1.0 --color -i -r \"User:\" -f llama.cpp/prompts/TcmChat.txt"
|
38 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
39 |
|
40 |
# 解析输出
|