Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,7 +75,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 75 |
|
| 76 |
agent = CodeAgent(
|
| 77 |
model=model,
|
| 78 |
-
tools=[visit_webpage_tool, web_search_tool, final_answer, image_generation_tool,
|
| 79 |
max_steps=6,
|
| 80 |
verbosity_level=1,
|
| 81 |
grammar=None,
|
|
@@ -86,21 +86,22 @@ agent = CodeAgent(
|
|
| 86 |
)
|
| 87 |
|
| 88 |
# Gradio interface with text and audio output
|
| 89 |
-
def
|
| 90 |
-
"""Wrapper function for Gradio to call
|
| 91 |
-
response_text, audio_file =
|
| 92 |
return response_text, audio_file
|
| 93 |
|
| 94 |
# Define the Gradio UI
|
| 95 |
with gr.Blocks() as demo:
|
| 96 |
-
gr.Markdown("###
|
|
|
|
| 97 |
with gr.Row():
|
| 98 |
input_box = gr.Textbox(label="Enter a word")
|
| 99 |
-
output_text = gr.Textbox(label="
|
| 100 |
output_audio = gr.Audio(label="Audio Pronunciation", type="filepath")
|
| 101 |
|
| 102 |
-
btn = gr.Button("Get
|
| 103 |
-
btn.click(
|
| 104 |
|
| 105 |
demo.launch()
|
| 106 |
|
|
|
|
| 75 |
|
| 76 |
agent = CodeAgent(
|
| 77 |
model=model,
|
| 78 |
+
tools=[visit_webpage_tool, web_search_tool, final_answer, image_generation_tool, search_dad_jokes], ## add your tools here (don't remove final answer)
|
| 79 |
max_steps=6,
|
| 80 |
verbosity_level=1,
|
| 81 |
grammar=None,
|
|
|
|
| 86 |
)
|
| 87 |
|
| 88 |
# Gradio interface with text and audio output
|
| 89 |
+
def gradio_search_jokes(word):
|
| 90 |
+
"""Wrapper function for Gradio to call search_dad_jokes and generate audio."""
|
| 91 |
+
response_text, audio_file = search_dad_jokes(word) # Ensure search_dad_jokes returns (text, file path)
|
| 92 |
return response_text, audio_file
|
| 93 |
|
| 94 |
# Define the Gradio UI
|
| 95 |
with gr.Blocks() as demo:
|
| 96 |
+
gr.Markdown("### Dad Jokes Finder with AI & Text-to-Speech 🎙️")
|
| 97 |
+
|
| 98 |
with gr.Row():
|
| 99 |
input_box = gr.Textbox(label="Enter a word")
|
| 100 |
+
output_text = gr.Textbox(label="Jokes Found")
|
| 101 |
output_audio = gr.Audio(label="Audio Pronunciation", type="filepath")
|
| 102 |
|
| 103 |
+
btn = gr.Button("Get Jokes")
|
| 104 |
+
btn.click(gradio_search_jokes, inputs=input_box, outputs=[output_text, output_audio])
|
| 105 |
|
| 106 |
demo.launch()
|
| 107 |
|