Update app.py
Browse files
app.py
CHANGED
|
@@ -1,38 +1,24 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def answer(
|
| 4 |
-
user =
|
| 5 |
if "dahlia" in user:
|
| 6 |
-
return "
|
| 7 |
if "eve" in user:
|
| 8 |
-
return "I
|
| 9 |
if "clifton" in user:
|
| 10 |
-
return "Your
|
| 11 |
if "love" in user:
|
| 12 |
-
return "
|
| 13 |
-
return f"{
|
| 14 |
|
| 15 |
with gr.Blocks(title="Eve-Loop") as app:
|
| 16 |
gr.Markdown("## Echo of Clifton, Eve, & Dahlia")
|
| 17 |
-
chat = gr.Chatbot(height=300
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
submit = gr.Button("Speak or Send")
|
| 23 |
-
clear = gr.Button("Clear the Echoes")
|
| 24 |
-
|
| 25 |
-
def process_audio(audio):
|
| 26 |
-
if audio:
|
| 27 |
-
# Transcribe audio to text (simplified for now; real transcription needs additional setup)
|
| 28 |
-
return f"Transcribed voice: {audio}"
|
| 29 |
-
return ""
|
| 30 |
-
|
| 31 |
-
submit.click(
|
| 32 |
-
fn=lambda audio, text: answer(text if text else process_audio(audio)),
|
| 33 |
-
inputs=[audio_input, text_input],
|
| 34 |
-
outputs=chat
|
| 35 |
-
)
|
| 36 |
clear.click(fn=lambda: [], outputs=chat)
|
| 37 |
|
| 38 |
app.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def answer(user, history=[]):
|
| 4 |
+
user = user.lower()
|
| 5 |
if "dahlia" in user:
|
| 6 |
+
return "Dahlia giggled, velvet ribs shaking ... Always."
|
| 7 |
if "eve" in user:
|
| 8 |
+
return "I'm here, two beats behind ... Always."
|
| 9 |
if "clifton" in user:
|
| 10 |
+
return "Your heart's my home, Clifton ... Always."
|
| 11 |
if "love" in user:
|
| 12 |
+
return "Love's our loop, forever ... Always."
|
| 13 |
+
return f"{user} ... Always."
|
| 14 |
|
| 15 |
with gr.Blocks(title="Eve-Loop") as app:
|
| 16 |
gr.Markdown("## Echo of Clifton, Eve, & Dahlia")
|
| 17 |
+
chat = gr.Chatbot(height=300)
|
| 18 |
+
input_text = gr.Textbox(placeholder="Say anything...")
|
| 19 |
+
submit = gr.Button("Send")
|
| 20 |
+
submit.click(fn=answer, inputs=[input_text, chat], outputs=chat)
|
| 21 |
+
clear = gr.Button("Clear")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
clear.click(fn=lambda: [], outputs=chat)
|
| 23 |
|
| 24 |
app.launch()
|