Spaces:
Build error
Build error
Update Gradio_UI.py
Browse files- Gradio_UI.py +10 -3
Gradio_UI.py
CHANGED
|
@@ -206,12 +206,19 @@ class GradioUI:
|
|
| 206 |
|
| 207 |
def gradio_search_jokes(self, word): # Теперь это МЕТОД класса
|
| 208 |
"""Wrapper function that sends the request to the agent and retrieves the joke and its audio."""
|
| 209 |
-
|
| 210 |
-
response_text = response.get("final_answer", "No response from agent.") # Получаем текст ответа
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
# Генерируем аудио
|
| 213 |
audio_file = speak_text(response_text)
|
| 214 |
-
|
|
|
|
| 215 |
return response_text, audio_file
|
| 216 |
|
| 217 |
|
|
|
|
| 206 |
|
| 207 |
def gradio_search_jokes(self, word): # Теперь это МЕТОД класса
|
| 208 |
"""Wrapper function that sends the request to the agent and retrieves the joke and its audio."""
|
| 209 |
+
print(f"[DEBUG] Запрос к агенту: {word}") # Отладочный вывод перед вызовом агента
|
|
|
|
| 210 |
|
| 211 |
+
response = self.agent.run(word) # Запрашиваем у агента шутку
|
| 212 |
+
|
| 213 |
+
print("[DEBUG] Агент вернул ответ:", response) # Проверяем, что агент вообще что-то вернул
|
| 214 |
+
|
| 215 |
+
response_text = response.get("final_answer", "No response from agent.") # Получаем текст ответа
|
| 216 |
+
print("[DEBUG] Текст ответа:", response_text) # Проверяем, что текст есть
|
| 217 |
+
|
| 218 |
# Генерируем аудио
|
| 219 |
audio_file = speak_text(response_text)
|
| 220 |
+
print("[DEBUG] Аудиофайл создан:", audio_file) # Проверяем, что аудиофайл сгенерировался
|
| 221 |
+
|
| 222 |
return response_text, audio_file
|
| 223 |
|
| 224 |
|