Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from llama_cpp import Llama
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
-
import os
|
| 5 |
|
| 6 |
MODEL_REPO = "synthdragon-studios/reasonyx"
|
| 7 |
MODEL_FILE = "reasonyx.gguf"
|
|
@@ -13,10 +12,12 @@ model_path = hf_hub_download(
|
|
| 13 |
)
|
| 14 |
|
| 15 |
llm = Llama(
|
| 16 |
-
model_path=model_path
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def chat(message, history):
|
|
|
|
| 20 |
|
| 21 |
for user, bot in history:
|
| 22 |
prompt += f"User: {user}\nAssistant: {bot}\n"
|
|
@@ -24,7 +25,7 @@ def chat(message, history):
|
|
| 24 |
prompt += f"User: {message}\nAssistant:"
|
| 25 |
|
| 26 |
output = llm(
|
| 27 |
-
prompt
|
| 28 |
max_tokens=256,
|
| 29 |
stop=["User:"]
|
| 30 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from llama_cpp import Llama
|
| 3 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 4 |
|
| 5 |
MODEL_REPO = "synthdragon-studios/reasonyx"
|
| 6 |
MODEL_FILE = "reasonyx.gguf"
|
|
|
|
| 12 |
)
|
| 13 |
|
| 14 |
llm = Llama(
|
| 15 |
+
model_path=model_path,
|
| 16 |
+
n_ctx=2048
|
| 17 |
)
|
| 18 |
|
| 19 |
def chat(message, history):
|
| 20 |
+
prompt = "You are Reasonyx, an AI assistant.\n\n"
|
| 21 |
|
| 22 |
for user, bot in history:
|
| 23 |
prompt += f"User: {user}\nAssistant: {bot}\n"
|
|
|
|
| 25 |
prompt += f"User: {message}\nAssistant:"
|
| 26 |
|
| 27 |
output = llm(
|
| 28 |
+
prompt=prompt,
|
| 29 |
max_tokens=256,
|
| 30 |
stop=["User:"]
|
| 31 |
)
|