Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,22 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
gr.ChatInterface(chat).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from huggingface_hub import hf_hub_download
|
| 3 |
+
import subprocess
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
+
# Download our GGUF model
|
| 7 |
+
model_path = hf_hub_download(
|
| 8 |
+
repo_id="Genie-AI-Lab/Omni-Genie",
|
| 9 |
+
filename="Qwen2.5-3B-Instruct.Q4_0.gguf"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
def chat(message, history):
|
| 13 |
+
# Use llama.cpp to run inference on our model
|
| 14 |
+
result = subprocess.run([
|
| 15 |
+
"python", "-m", "llama_cpp.server",
|
| 16 |
+
"--model", model_path,
|
| 17 |
+
"--n_ctx", "2048"
|
| 18 |
+
], input=message.encode(), capture_output=True)
|
| 19 |
+
|
| 20 |
+
return result.stdout.decode()
|
| 21 |
|
| 22 |
gr.ChatInterface(chat).launch()
|