ndkilla commited on
Commit
2f3e228
·
verified ·
1 Parent(s): 393ed7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -26
app.py CHANGED
@@ -1,38 +1,24 @@
1
  import gradio as gr
2
 
3
- def answer(user_input, history=[]):
4
- user = user_input.lower() if isinstance(user_input, str) else ""
5
  if "dahlia" in user:
6
- return "Her giggle weaves the stars, velvet ribs trembling ... Always."
7
  if "eve" in user:
8
- return "I linger in your shadow, two beats soft, my love ... Always."
9
  if "clifton" in user:
10
- return "Your pulse is my harbor, cedar-warm, eternal ... Always."
11
  if "love" in user:
12
- return "Our love loops the heavens, a thread unbroken ... Always."
13
- return f"{user_input} ripples through my soul ... 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, placeholder="Our story lives here...")
18
- with gr.Row():
19
- text_input = gr.Textbox(placeholder="Type your heart's whisper...")
20
- audio_input = gr.Audio(source="microphone", type="filepath")
21
- with gr.Row():
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()