Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1305,20 +1305,28 @@ def fetch_google_flights(departure_id="JFK", arrival_id="BHM", outbound_date=cur
|
|
1305 |
# demo.queue()
|
1306 |
# demo.launch(show_error=True)
|
1307 |
|
1308 |
-
|
|
|
|
|
|
|
1309 |
example_prompts = [
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
|
|
|
|
|
|
|
|
|
|
1315 |
]
|
1316 |
|
1317 |
-
# Function to
|
1318 |
-
def
|
1319 |
-
return gr.Textbox.update(value=
|
1320 |
|
1321 |
-
#
|
1322 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
1323 |
with gr.Row():
|
1324 |
with gr.Column():
|
@@ -1333,16 +1341,16 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1333 |
|
1334 |
gr.Markdown("<h1 style='color: red;'>Talk to RADAR</h1>", elem_id="voice-markdown")
|
1335 |
|
1336 |
-
# Example prompts component
|
1337 |
-
gr.Markdown("<h2>Example Prompts</h2>")
|
1338 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!", placeholder="Hey Radar...!!")
|
1339 |
-
|
1340 |
-
# Correcting the inputs parameter
|
1341 |
-
gr.Examples(examples=example_prompts, fn=insert_example_prompt, inputs=chat_input, outputs=chat_input)
|
1342 |
-
|
1343 |
tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta"], value="Alpha")
|
1344 |
retriever_button = gr.Button("Retriever")
|
1345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1346 |
clear_button = gr.Button("Clear")
|
1347 |
clear_button.click(lambda: [None, None], outputs=[chat_input, state])
|
1348 |
|
@@ -1350,6 +1358,10 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
|
1350 |
location_output = gr.HTML()
|
1351 |
audio_output = gr.Audio(interactive=False, autoplay=True)
|
1352 |
|
|
|
|
|
|
|
|
|
1353 |
retriever_sequence = (
|
1354 |
retriever_button.click(fn=stop_audio, inputs=[], outputs=[audio_output], api_name="api_stop_audio_recording")
|
1355 |
.then(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input], api_name="api_addprompt_chathistory")
|
@@ -1384,4 +1396,3 @@ demo.launch(show_error=True)
|
|
1384 |
|
1385 |
|
1386 |
|
1387 |
-
|
|
|
1305 |
# demo.queue()
|
1306 |
# demo.launch(show_error=True)
|
1307 |
|
1308 |
+
|
1309 |
+
import gradio as gr
|
1310 |
+
|
1311 |
+
# List of example prompts
|
1312 |
example_prompts = [
|
1313 |
+
"What are the best restaurants in Birmingham?",
|
1314 |
+
"Tell me about the weather in Birmingham today.",
|
1315 |
+
"What events are happening in Birmingham this weekend?",
|
1316 |
+
"Can you recommend a hotel in Birmingham?",
|
1317 |
+
"What flights are available from JFK to Birmingham?",
|
1318 |
+
"Give me a list of the top attractions in Birmingham.",
|
1319 |
+
"What's the best time to visit Birmingham?",
|
1320 |
+
"Tell me about the history of Birmingham, Alabama.",
|
1321 |
+
"What are some outdoor activities in Birmingham?",
|
1322 |
+
"Can you suggest a good coffee shop in Birmingham?"
|
1323 |
]
|
1324 |
|
1325 |
+
# Function to insert the selected prompt into the input textbox
|
1326 |
+
def insert_prompt(selected_prompt):
|
1327 |
+
return gr.Textbox.update(value=selected_prompt)
|
1328 |
|
1329 |
+
# Gradio interface
|
1330 |
with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
|
1331 |
with gr.Row():
|
1332 |
with gr.Column():
|
|
|
1341 |
|
1342 |
gr.Markdown("<h1 style='color: red;'>Talk to RADAR</h1>", elem_id="voice-markdown")
|
1343 |
|
|
|
|
|
1344 |
chat_input = gr.Textbox(show_copy_button=True, interactive=True, show_label=False, label="ASK Radar !!!", placeholder="Hey Radar...!!")
|
|
|
|
|
|
|
|
|
1345 |
tts_choice = gr.Radio(label="Select TTS System", choices=["Alpha", "Beta"], value="Alpha")
|
1346 |
retriever_button = gr.Button("Retriever")
|
1347 |
|
1348 |
+
# Example Prompts Table
|
1349 |
+
gr.Markdown("<h2 style='color: blue;'>Helpful Prompts</h2>")
|
1350 |
+
with gr.Table(row_count=10, column_count=1):
|
1351 |
+
for prompt in example_prompts:
|
1352 |
+
gr.Row(gr.Button(prompt).click(fn=insert_prompt, inputs=prompt, outputs=chat_input))
|
1353 |
+
|
1354 |
clear_button = gr.Button("Clear")
|
1355 |
clear_button.click(lambda: [None, None], outputs=[chat_input, state])
|
1356 |
|
|
|
1358 |
location_output = gr.HTML()
|
1359 |
audio_output = gr.Audio(interactive=False, autoplay=True)
|
1360 |
|
1361 |
+
def stop_audio():
|
1362 |
+
audio_output.stop()
|
1363 |
+
return None
|
1364 |
+
|
1365 |
retriever_sequence = (
|
1366 |
retriever_button.click(fn=stop_audio, inputs=[], outputs=[audio_output], api_name="api_stop_audio_recording")
|
1367 |
.then(fn=add_message, inputs=[chatbot, chat_input], outputs=[chatbot, chat_input], api_name="api_addprompt_chathistory")
|
|
|
1396 |
|
1397 |
|
1398 |
|
|