Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,18 @@ import os
|
|
5 |
from llama_cpp import Llama
|
6 |
from huggingface_hub import snapshot_download
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# 下载并转换模型
|
9 |
def git_llama():
|
10 |
if not os.path.exists('llama.cpp'):
|
|
|
5 |
from llama_cpp import Llama
|
6 |
from huggingface_hub import snapshot_download
|
7 |
|
8 |
+
def run_command(command, cwd=None):
|
9 |
+
"""运行系统命令"""
|
10 |
+
result = subprocess.run(command, shell=True, cwd=cwd, text=True, capture_output=True)
|
11 |
+
if result.returncode != 0:
|
12 |
+
print(f"命令执行失败: {command}")
|
13 |
+
print(f"错误信息: {result.stderr}")
|
14 |
+
exit(result.returncode)
|
15 |
+
else:
|
16 |
+
print(f"命令执行成功: {command}")
|
17 |
+
print(result.stdout)
|
18 |
+
|
19 |
+
|
20 |
# 下载并转换模型
|
21 |
def git_llama():
|
22 |
if not os.path.exists('llama.cpp'):
|