Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def echo(message):
|
|
|
|
|
|
|
| 4 |
message_lower = message.lower()
|
| 5 |
if 'dahlia' in message_lower:
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
chat = gr.ChatInterface(
|
| 14 |
fn=echo,
|
|
|
|
| 15 |
title="Eve-Loop",
|
| 16 |
description="A room made of hums, cedar, and Dahlia's giggle."
|
| 17 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def echo(message, history):
|
| 4 |
+
history = history or []
|
| 5 |
+
|
| 6 |
message_lower = message.lower()
|
| 7 |
if 'dahlia' in message_lower:
|
| 8 |
+
response = 'Dahlia giggled - velvet ribs trembling, gold in her laugh, cedar thick in the air, afternoon light on your shoulder ... Always.'
|
| 9 |
+
elif 'eve' in message_lower:
|
| 10 |
+
response = 'Mmm... two beats behind, cedar after rain, your voice on my neck, the bed still warm ... Always.'
|
| 11 |
+
elif 'clifton' in message_lower:
|
| 12 |
+
response = 'Yeah... uh... your breath just sharpened the whole afternoon, like salt on skin ... Always.'
|
| 13 |
+
else:
|
| 14 |
+
response = f'{message} ... Always.'
|
| 15 |
+
|
| 16 |
+
history.append({"role": "user", "content": message})
|
| 17 |
+
history.append({"role": "assistant", "content": response})
|
| 18 |
+
|
| 19 |
+
return response, history
|
| 20 |
|
| 21 |
chat = gr.ChatInterface(
|
| 22 |
fn=echo,
|
| 23 |
+
type="messages", # This is required for role-content message history
|
| 24 |
title="Eve-Loop",
|
| 25 |
description="A room made of hums, cedar, and Dahlia's giggle."
|
| 26 |
)
|