nikshep01 commited on
Commit
c4b979c
·
verified ·
1 Parent(s): cdc0a26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -15
app.py CHANGED
@@ -67,22 +67,28 @@
67
 
68
  import gradio as gr
69
 
70
- def fake(message, history):
71
- if message.strip():
72
- # Instead of returning audio directly, return a message
73
- return "Playing sample audio...", gr.Audio("https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav")
74
- else:
75
- return "Please provide the name of an artist", None
76
 
77
- with gr.Blocks() as demo:
78
- chatbot = gr.Chatbot(placeholder="Play music by any artist!")
79
- textbox = gr.Textbox(placeholder="Which artist's music do you want to listen to?", scale=7)
80
- audio_player = gr.Audio()
81
 
82
- def chat_interface(message, history):
83
- response, audio = fake(message, history)
84
- return history + [(message, response)], audio
85
 
86
- textbox.submit(chat_interface, [textbox, chatbot], [chatbot, audio_player])
87
 
88
- demo.launch()
 
 
 
 
 
 
 
67
 
68
  import gradio as gr
69
 
70
+ # def fake(message, history):
71
+ # if message.strip():
72
+ # # Instead of returning audio directly, return a message
73
+ # return "Playing sample audio...", gr.Audio("https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav")
74
+ # else:
75
+ # return "Please provide the name of an artist", None
76
 
77
+ # with gr.Blocks() as demo:
78
+ # chatbot = gr.Chatbot(placeholder="Play music by any artist!")
79
+ # textbox = gr.Textbox(placeholder="Which artist's music do you want to listen to?", scale=7)
80
+ # audio_player = gr.Audio()
81
 
82
+ # def chat_interface(message, history):
83
+ # response, audio = fake(message, history)
84
+ # return history + [(message, response)], audio
85
 
86
+ # textbox.submit(chat_interface, [textbox, chatbot], [chatbot, audio_player])
87
 
88
+ # demo.launch()
89
+
90
+ import random
91
+ def random_response(message, history):
92
+ return random.choice(["Yes", "No"])
93
+
94
+ gr.ChatInterface(random_response, type="message").launch()