uasername commited on
Commit
72d2b0a
·
verified ·
1 Parent(s): c35211c

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. 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,