Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -98,10 +98,12 @@ def launch():
|
|
98 |
OLLAMA_SERVICE_THREAD = threading.Thread(target=ollama_service_thread)
|
99 |
OLLAMA_SERVICE_THREAD.start()
|
100 |
print("Giving ollama serve a moment")
|
101 |
-
time.sleep(
|
102 |
|
103 |
@spaces.GPU()
|
104 |
async def stream_chat(message: str, history: list, model: str, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
|
|
|
|
|
105 |
print(f"message: {message}")
|
106 |
conversation = []
|
107 |
for prompt, answer in history:
|
@@ -143,10 +145,7 @@ async def main(message: str, history: list, model: str, temperature: float, max_
|
|
143 |
else:
|
144 |
if not INIT_SIGN:
|
145 |
yield "Please initialize Ollama"
|
146 |
-
else:
|
147 |
-
if not process:
|
148 |
-
launch()
|
149 |
-
|
150 |
async for response in stream_chat(
|
151 |
message,
|
152 |
history,
|
|
|
98 |
OLLAMA_SERVICE_THREAD = threading.Thread(target=ollama_service_thread)
|
99 |
OLLAMA_SERVICE_THREAD.start()
|
100 |
print("Giving ollama serve a moment")
|
101 |
+
time.sleep(5)
|
102 |
|
103 |
@spaces.GPU()
|
104 |
async def stream_chat(message: str, history: list, model: str, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
|
105 |
+
if not process:
|
106 |
+
launch()
|
107 |
print(f"message: {message}")
|
108 |
conversation = []
|
109 |
for prompt, answer in history:
|
|
|
145 |
else:
|
146 |
if not INIT_SIGN:
|
147 |
yield "Please initialize Ollama"
|
148 |
+
else:
|
|
|
|
|
|
|
149 |
async for response in stream_chat(
|
150 |
message,
|
151 |
history,
|