Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load
|
| 5 |
pipe = pipeline(
|
| 6 |
"text-generation",
|
| 7 |
model="Qwen/Qwen2.5-0.5B-Instruct",
|
|
@@ -13,7 +13,7 @@ def chat(message, history):
|
|
| 13 |
if history is None:
|
| 14 |
history = []
|
| 15 |
|
| 16 |
-
# Build
|
| 17 |
messages = [{"role": "system", "content": "You are a helpful, creative assistant good at coding, vibing, stories, and worldbuilding."}]
|
| 18 |
|
| 19 |
for human, assistant in history:
|
|
@@ -43,6 +43,7 @@ def chat(message, history):
|
|
| 43 |
except Exception as e:
|
| 44 |
reply = f"Error: {str(e)}"
|
| 45 |
|
|
|
|
| 46 |
history.append((message, reply))
|
| 47 |
return history
|
| 48 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load tiny model
|
| 5 |
pipe = pipeline(
|
| 6 |
"text-generation",
|
| 7 |
model="Qwen/Qwen2.5-0.5B-Instruct",
|
|
|
|
| 13 |
if history is None:
|
| 14 |
history = []
|
| 15 |
|
| 16 |
+
# Build messages for the model
|
| 17 |
messages = [{"role": "system", "content": "You are a helpful, creative assistant good at coding, vibing, stories, and worldbuilding."}]
|
| 18 |
|
| 19 |
for human, assistant in history:
|
|
|
|
| 43 |
except Exception as e:
|
| 44 |
reply = f"Error: {str(e)}"
|
| 45 |
|
| 46 |
+
# Use tuple format - most compatible with Gradio
|
| 47 |
history.append((message, reply))
|
| 48 |
return history
|
| 49 |
|