Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -87,29 +87,29 @@ agent = CodeAgent(
|
|
87 |
prompt_templates=prompt_templates
|
88 |
)
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
GradioUI(agent).launch()
|
114 |
|
115 |
|
|
|
87 |
prompt_templates=prompt_templates
|
88 |
)
|
89 |
|
90 |
+
Gradio interface with text and audio output
|
91 |
+
def gradio_search_jokes(word):
|
92 |
+
"""Wrapper function for Gradio to call search_dad_jokes and generate audio."""
|
93 |
+
response_text, audio_file = search_dad_jokes(word) # Ensure search_dad_jokes returns (text, file path)
|
94 |
+
return response_text, audio_file
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
Define the Gradio UI
|
99 |
+
with gr.Blocks() as demo:
|
100 |
+
gr.Markdown("### Dad Jokes Finder with AI & Text-to-Speech 🎙️")
|
101 |
+
|
102 |
+
with gr.Row():
|
103 |
+
input_box = gr.Textbox(label="Enter a word")
|
104 |
+
output_text = gr.Textbox(label="Jokes Found")
|
105 |
+
output_audio = gr.Audio(label="Audio Pronunciation", type="filepath")
|
106 |
+
|
107 |
+
btn = gr.Button("Get Jokes")
|
108 |
+
btn.click(gradio_search_jokes, inputs=input_box, outputs=[output_text, output_audio])
|
109 |
+
|
110 |
+
demo.launch()
|
111 |
+
|
112 |
+
|
113 |
+
# GradioUI(agent).launch()
|
114 |
|
115 |
|