Spaces:
Running
Running
Update Gradio_UI.py
Browse files- Gradio_UI.py +13 -0
Gradio_UI.py
CHANGED
@@ -26,6 +26,19 @@ from smolagents.utils import _is_package_available
|
|
26 |
|
27 |
#from jokes import gradio_search_jokes
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
def pull_messages_from_step(
|
31 |
step_log: MemoryStep,
|
|
|
26 |
|
27 |
#from jokes import gradio_search_jokes
|
28 |
|
29 |
+
from app import agent # Импортируем объект агента
|
30 |
+
|
31 |
+
def gradio_search_jokes(word):
|
32 |
+
"""Wrapper function that sends the request to the agent and retrieves the joke and its audio."""
|
33 |
+
response = agent.run(word) # Отправляем запрос агенту
|
34 |
+
response_text = response.get("final_answer", "No response from agent.") # Получаем текст ответа
|
35 |
+
|
36 |
+
# Генерируем аудио
|
37 |
+
audio_file = speak_text(response_text)
|
38 |
+
|
39 |
+
return response_text, audio_file
|
40 |
+
|
41 |
+
|
42 |
|
43 |
def pull_messages_from_step(
|
44 |
step_log: MemoryStep,
|