Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -227,6 +227,19 @@ def generate_audio_from_last_response(history):
|
|
227 |
return generate_audio_elevenlabs(recent_response)
|
228 |
return None
|
229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
|
232 |
# Create the Gradio Blocks interface
|
@@ -234,14 +247,9 @@ with gr.Blocks() as demo:
|
|
234 |
chatbot = gr.Chatbot([], elem_id="RADAR", bubble_full_width=False)
|
235 |
with gr.Row():
|
236 |
with gr.Column():
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
#interactive=False,
|
241 |
-
#lines=10, # Sets the number of visible lines
|
242 |
-
#max_lines=20 # Allows for a larger display area if needed
|
243 |
-
#)
|
244 |
-
question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
|
245 |
|
246 |
with gr.Column():
|
247 |
audio_output = gr.Audio(label="Audio", type="filepath", interactive=False)
|
@@ -253,7 +261,11 @@ with gr.Blocks() as demo:
|
|
253 |
generate_audio_btn = gr.Button("Generate Audio")
|
254 |
with gr.Column():
|
255 |
clean_btn = gr.Button("Clean")
|
256 |
-
|
|
|
|
|
|
|
|
|
257 |
# Define interactions
|
258 |
#get_response_btn.click(fn=get_response, inputs=question_input, outputs=response_output)
|
259 |
#generate_audio_btn.click(fn=generate_audio_elevenlabs, inputs=response_output, outputs=audio_output)
|
|
|
227 |
return generate_audio_elevenlabs(recent_response)
|
228 |
return None
|
229 |
|
230 |
+
# Define example prompts
|
231 |
+
examples = [
|
232 |
+
["What are some popular events in Birmingham?"],
|
233 |
+
["Who are the top players of the Crimson Tide?"],
|
234 |
+
["Where can I find a hamburger?"],
|
235 |
+
["What are some popular tourist attractions in Birmingham?"],
|
236 |
+
["What are some good clubs in Birmingham?"]
|
237 |
+
]
|
238 |
+
|
239 |
+
# Function to insert the prompt into the textbox when clicked
|
240 |
+
def insert_prompt(current_text, prompt):
|
241 |
+
return prompt[0] if prompt else current_text
|
242 |
+
|
243 |
|
244 |
|
245 |
# Create the Gradio Blocks interface
|
|
|
247 |
chatbot = gr.Chatbot([], elem_id="RADAR", bubble_full_width=False)
|
248 |
with gr.Row():
|
249 |
with gr.Column():
|
250 |
+
question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
|
251 |
+
|
252 |
+
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
with gr.Column():
|
255 |
audio_output = gr.Audio(label="Audio", type="filepath", interactive=False)
|
|
|
261 |
generate_audio_btn = gr.Button("Generate Audio")
|
262 |
with gr.Column():
|
263 |
clean_btn = gr.Button("Clean")
|
264 |
+
|
265 |
+
with gr.Row():
|
266 |
+
with gr.Column():
|
267 |
+
gr.Markdown("<h1 style='color: red;'>Example Prompts</h1>", elem_id="Example-Prompts")
|
268 |
+
gr.Examples(examples=examples, fn=insert_prompt, inputs=question_input, outputs=question_input)
|
269 |
# Define interactions
|
270 |
#get_response_btn.click(fn=get_response, inputs=question_input, outputs=response_output)
|
271 |
#generate_audio_btn.click(fn=generate_audio_elevenlabs, inputs=response_output, outputs=audio_output)
|