Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import subprocess
|
2 |
def run_command(command, cwd=None):
|
3 |
"""运行系统命令"""
|
@@ -10,7 +12,6 @@ def run_command(command, cwd=None):
|
|
10 |
print(f"命令执行成功: {command}")
|
11 |
print(result.stdout)
|
12 |
|
13 |
-
|
14 |
run_command('pip install llama-cpp-python')
|
15 |
|
16 |
import gradio as gr
|
@@ -18,7 +19,6 @@ import os
|
|
18 |
from llama_cpp import Llama
|
19 |
from huggingface_hub import snapshot_download
|
20 |
|
21 |
-
|
22 |
def setup_llama_cpp():
|
23 |
"""克隆并编译llama.cpp仓库"""
|
24 |
if not os.path.exists('llama.cpp'):
|
@@ -66,7 +66,6 @@ def chat_with_model(message, history, system_prompt, temperature, max_tokens, to
|
|
66 |
yield response
|
67 |
|
68 |
if __name__ == "__main__":
|
69 |
-
MODEL_ID = "ibm-granite/granite-3.1-2b-instruct"
|
70 |
setup_llama_cpp()
|
71 |
MODEL_PATH = setup_model(MODEL_ID)
|
72 |
llm = Llama(
|
|
|
1 |
+
MODEL_ID = "ibm-granite/granite-3.1-2b-instruct"
|
2 |
+
|
3 |
import subprocess
|
4 |
def run_command(command, cwd=None):
|
5 |
"""运行系统命令"""
|
|
|
12 |
print(f"命令执行成功: {command}")
|
13 |
print(result.stdout)
|
14 |
|
|
|
15 |
run_command('pip install llama-cpp-python')
|
16 |
|
17 |
import gradio as gr
|
|
|
19 |
from llama_cpp import Llama
|
20 |
from huggingface_hub import snapshot_download
|
21 |
|
|
|
22 |
def setup_llama_cpp():
|
23 |
"""克隆并编译llama.cpp仓库"""
|
24 |
if not os.path.exists('llama.cpp'):
|
|
|
66 |
yield response
|
67 |
|
68 |
if __name__ == "__main__":
|
|
|
69 |
setup_llama_cpp()
|
70 |
MODEL_PATH = setup_model(MODEL_ID)
|
71 |
llm = Llama(
|