Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,8 @@ llm = Llama(
|
|
18 |
model_path=model_path,
|
19 |
n_ctx=2048,
|
20 |
n_threads=n_threads,
|
21 |
-
n_gpu_layers=0
|
22 |
)
|
23 |
-
# I see from your logs it found 16 threads! That's a powerful CPU Space.
|
24 |
print(f"Model loaded for CPU execution with {n_threads} threads.")
|
25 |
|
26 |
|
@@ -37,23 +36,23 @@ You are Dolphin 3.0, a helpful and friendly AI assistant.
|
|
37 |
{message}
|
38 |
|
39 |
### Assistant:"""
|
40 |
-
|
41 |
stream = llm(
|
42 |
full_prompt,
|
43 |
max_tokens=1024,
|
44 |
stop=["</s>", "### User:", "### Assistant:"],
|
45 |
stream=True
|
46 |
)
|
47 |
-
|
48 |
partial_message = ""
|
49 |
for output in stream:
|
50 |
token = output['choices'][0]['text']
|
51 |
partial_message += token
|
52 |
yield partial_message
|
53 |
|
54 |
-
# --- 4. The Enhanced Chatbot UI (
|
55 |
-
# We
|
56 |
-
#
|
57 |
iface = gr.ChatInterface(
|
58 |
fn=chat,
|
59 |
title="🐬 Dolphin 3.0 on Hugging Face Spaces",
|
@@ -63,7 +62,6 @@ iface = gr.ChatInterface(
|
|
63 |
theme="soft",
|
64 |
examples=[["Hello!"], ["Write a short poem about the stars."], ["What is the capital of India?"]],
|
65 |
cache_examples=False,
|
66 |
-
clear_btn="Clear Chat", # This one is universally loved and supported
|
67 |
)
|
68 |
|
69 |
|
|
|
18 |
model_path=model_path,
|
19 |
n_ctx=2048,
|
20 |
n_threads=n_threads,
|
21 |
+
n_gpu_layers=0
|
22 |
)
|
|
|
23 |
print(f"Model loaded for CPU execution with {n_threads} threads.")
|
24 |
|
25 |
|
|
|
36 |
{message}
|
37 |
|
38 |
### Assistant:"""
|
39 |
+
|
40 |
stream = llm(
|
41 |
full_prompt,
|
42 |
max_tokens=1024,
|
43 |
stop=["</s>", "### User:", "### Assistant:"],
|
44 |
stream=True
|
45 |
)
|
46 |
+
|
47 |
partial_message = ""
|
48 |
for output in stream:
|
49 |
token = output['choices'][0]['text']
|
50 |
partial_message += token
|
51 |
yield partial_message
|
52 |
|
53 |
+
# --- 4. The Enhanced Chatbot UI (MAXIMUM COMPATIBILITY) ---
|
54 |
+
# We are removing ALL custom button arguments to ensure this works on older Gradio versions.
|
55 |
+
# Gradio will add the default 'Undo' and 'Clear' buttons for us.
|
56 |
iface = gr.ChatInterface(
|
57 |
fn=chat,
|
58 |
title="🐬 Dolphin 3.0 on Hugging Face Spaces",
|
|
|
62 |
theme="soft",
|
63 |
examples=[["Hello!"], ["Write a short poem about the stars."], ["What is the capital of India?"]],
|
64 |
cache_examples=False,
|
|
|
65 |
)
|
66 |
|
67 |
|