Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,8 @@ subprocess.run("~/ollama pull gemma2", shell=True)
|
|
22 |
|
23 |
import copy
|
24 |
import gradio as gr
|
25 |
-
import
|
26 |
-
|
27 |
|
28 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
29 |
MODEL_ID = os.environ.get("MODEL_ID", "google/gemma-2-9b-it")
|
@@ -65,7 +65,7 @@ def stream_chat(message: str, history: list, temperature: float, context_window:
|
|
65 |
|
66 |
print(f"Conversation is -\n{conversation}")
|
67 |
|
68 |
-
response =
|
69 |
model="gemma2",
|
70 |
messages=conversation,
|
71 |
stream=True
|
|
|
22 |
|
23 |
import copy
|
24 |
import gradio as gr
|
25 |
+
from ollama import Client
|
26 |
+
client = Client(host='http://localhost:11434', timeout=60)
|
27 |
|
28 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
29 |
MODEL_ID = os.environ.get("MODEL_ID", "google/gemma-2-9b-it")
|
|
|
65 |
|
66 |
print(f"Conversation is -\n{conversation}")
|
67 |
|
68 |
+
response = client.chat(
|
69 |
model="gemma2",
|
70 |
messages=conversation,
|
71 |
stream=True
|