PatrickRedStar commited on
Commit
44067ef
·
1 Parent(s): 57f7392
.gitignore ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EXAMPLE_PROJECT/
2
+ .git/
3
+ __pycache__/*
4
+ .vscode/
5
+ .idea/
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .DS_Store
9
+ .env
10
+ .env.local
11
+ .env.development.local
12
+ .env.test.local
13
+ .env.production.local
14
+ .env.development
15
+ .env.test
16
+ */__pycache__/*
EXAMPLE_PROJECT ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit b31771a8bb8f716a72a89ece3dcf2d1e7e29a74a
__pycache__/agents.cpython-314.pyc ADDED
Binary file (8.22 kB). View file
 
__pycache__/app.cpython-314.pyc CHANGED
Binary files a/__pycache__/app.cpython-314.pyc and b/__pycache__/app.cpython-314.pyc differ
 
agents.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Агенты для анализа логов на основе smolagents.
3
+ Используют трансформеры для интеллектуального анализа.
4
+ """
5
+
6
+ import os
7
+ import json
8
+ from smolagents import ToolCallingAgent, InferenceClientModel, FinalAnswerTool
9
+ from schemas.schemas import parser_schema, anomaly_schema, rca_schema
10
+ from utils.validation import validate_schema
11
+ from utils.agent_runner import run_agent_safely
12
+
13
+ # Загружаем модель
14
+ model = InferenceClientModel(
15
+ model_id="deepseek-ai/DeepSeek-V3.1-Terminus",
16
+ token=os.getenv("HF_TOKEN"),
17
+ max_tokens=2048
18
+ )
19
+
20
+ final_tool = FinalAnswerTool()
21
+
22
+ # Агент 1: Парсинг логов
23
+ parser_agent = ToolCallingAgent(
24
+ model=model,
25
+ tools=[final_tool],
26
+ instructions="""
27
+ Ты эксперт по анализу системных логов. Твоя задача - парсить сырые логи и преобразовывать их в структурированный JSON формат.
28
+
29
+ Для каждой строки лога определи:
30
+ - timestamp: временная метка (если есть)
31
+ - level: уровень логирования (INFO, WARNING, ERROR, CRITICAL, DEBUG, TRACE)
32
+ - message: основное сообщение
33
+ - type: тип события (SYSTEM, HTTP_REQUEST, DATABASE, AUTHENTICATION, CONNECTION, EXCEPTION, GENERAL)
34
+
35
+ Также определи:
36
+ - errors: список всех ошибок (ERROR, CRITICAL)
37
+ - warnings: список всех предупреждений (WARNING)
38
+ - statistics: статистика с total_lines, parsed_events, errors, warnings, info_messages, event_types, time_range
39
+
40
+ Временной диапазон (time_range) должен содержать start и end - первую и последнюю временную метку.
41
+
42
+ Ответ строго верни в JSON через final_answer в следующем формате:
43
+ {
44
+ "events": [{"line_number": int, "timestamp": "str|null", "level": "str", "message": "str", "type": "str"}, ...],
45
+ "errors": [...],
46
+ "warnings": [...],
47
+ "statistics": {
48
+ "total_lines": int,
49
+ "parsed_events": int,
50
+ "errors": int,
51
+ "warnings": int,
52
+ "info_messages": int,
53
+ "event_types": {"TYPE": count, ...},
54
+ "time_range": {"start": "str|null", "end": "str|null"} | null
55
+ }
56
+ }
57
+ """,
58
+ name="LogParserAgent",
59
+ max_steps=10,
60
+ )
61
+
62
+ # Агент 2: Обнаружение аномалий
63
+ anomaly_agent = ToolCallingAgent(
64
+ model=model,
65
+ tools=[final_tool],
66
+ instructions="""
67
+ Ты эксперт по обнаружению аномалий в системных логах. Твоя задача - анализировать структурированные логи и находить проблемные паттерны.
68
+
69
+ Ищи следующие типы аномалий:
70
+ 1. BURST_ERRORS - всплески ошибок (5+ ошибок за короткий промежуток времени)
71
+ 2. REPEATED_ERRORS - повторяющиеся ошибки (одна и та же ошибка 3+ раза)
72
+ 3. ERROR_BEFORE_CRASH - ошибки перед крашем системы (критические ошибки в конце логов)
73
+ 4. TEMPORAL_SPIKE - временные всплески событий (превышение среднего в 2 раза)
74
+ 5. REPEATED_STACK_TRACES - повторяющиеся stack traces
75
+
76
+ Для каждой аномалии укажи:
77
+ - type: тип аномалии
78
+ - severity: CRITICAL, HIGH, MEDIUM, LOW
79
+ - description: описание проблемы
80
+ - count: количество вхождений (если применимо)
81
+ - error_message: пример сообщения об ошибке (если есть)
82
+ - metadata: дополнительная информация (affected_lines и т.д.)
83
+
84
+ Также вычисли статистику:
85
+ - total: общее количество аномалий
86
+ - by_type: распределение по типам
87
+ - by_severity: распределение по серьёзности
88
+
89
+ Ответ строго верни в JSON через final_answer в следующем формате:
90
+ {
91
+ "anomalies": [{"type": "str", "severity": "str", "description": "str", "count": int|null, "error_message": "str|null", "metadata": object|null}, ...],
92
+ "statistics": {
93
+ "total": int,
94
+ "by_type": {"TYPE": count, ...},
95
+ "by_severity": {"SEVERITY": count, ...}
96
+ },
97
+ "severity_summary": {"CRITICAL": int, "HIGH": int, "MEDIUM": int, "LOW": int}
98
+ }
99
+ """,
100
+ name="AnomalyDetectionAgent",
101
+ max_steps=10,
102
+ )
103
+
104
+ # Агент 3: Анализ первопричин и рекомендации
105
+ rca_agent = ToolCallingAgent(
106
+ model=model,
107
+ tools=[final_tool],
108
+ instructions="""
109
+ Ты эксперт по анализу первопричин и формированию ре��омендаций. Твоя задача - интерпретировать обнаруженные аномалии и предлагать конкретные решения.
110
+
111
+ Для каждой группы аномалий определи:
112
+ - possible_causes: возможные первопричины проблемы
113
+ - recommendations: рекомендации по устранению с приоритетами (CRITICAL, HIGH, MEDIUM, LOW)
114
+ - actions: конкретные действия для решения проблемы
115
+
116
+ Также сформулируй общие рекомендации для улучшения системы мониторинга и предотвращения подобных проблем.
117
+
118
+ Ответ строго верни в JSON через final_answer в следующем формате:
119
+ {
120
+ "analysis": {
121
+ "root_causes": ["причина1", "причина2", ...],
122
+ "details": [{
123
+ "anomaly_type": "str",
124
+ "severity": "str",
125
+ "description": "str",
126
+ "possible_causes": ["причина1", ...]
127
+ }, ...]
128
+ },
129
+ "recommendations": [{
130
+ "priority": "str",
131
+ "text": "str",
132
+ "actions": ["действие1", "действие2", ...]
133
+ }, ...],
134
+ "general_recommendations": ["рекомендация1", "рекомендация2", ...]
135
+ }
136
+ """,
137
+ name="RootCauseAgent",
138
+ max_steps=10,
139
+ )
140
+
141
+ # Pipeline шаг 1 — парсинг логов
142
+ def run_parser_agent(raw_logs: str):
143
+ """Парсит сырые логи в структурированный формат."""
144
+ if not raw_logs or not raw_logs.strip():
145
+ return {
146
+ "events": [],
147
+ "errors": [],
148
+ "warnings": [],
149
+ "statistics": {
150
+ "total_lines": 0,
151
+ "parsed_events": 0,
152
+ "errors": 0,
153
+ "warnings": 0,
154
+ "info_messages": 0,
155
+ "event_types": {},
156
+ "time_range": None
157
+ }
158
+ }
159
+
160
+ result = run_agent_safely(parser_agent, task=raw_logs)
161
+ validate_schema(result, parser_schema)
162
+ return result
163
+
164
+ # Pipeline шаг 2 — обнаружение аномалий
165
+ def run_anomaly_agent(structured_data: dict):
166
+ """Обнаруживает аномалии в структурированных логах."""
167
+ input_data = json.dumps(structured_data, ensure_ascii=False, indent=2)
168
+ result = run_agent_safely(anomaly_agent, task=input_data)
169
+ validate_schema(result, anomaly_schema)
170
+ return result
171
+
172
+ # Pipeline шаг 3 — анализ первопричин и рекомендации
173
+ def run_rca_agent(anomaly_report: dict):
174
+ """Анализирует первопричины и генерирует рекомендации."""
175
+ input_data = json.dumps(anomaly_report, ensure_ascii=False, indent=2)
176
+ result = run_agent_safely(rca_agent, task=input_data)
177
+ validate_schema(result, rca_schema)
178
+ return result
agents/gpt_prompt_agent.py CHANGED
@@ -1,325 +1,325 @@
1
- """
2
- Agent 4: GPT Prompt Generator Agent
3
- Формирует детальный промпт для GPT-модели с полным контекстом проблемы и системы.
4
- """
5
-
6
- from typing import Dict, List, Any, Optional
7
- from datetime import datetime
8
-
9
-
10
- class GPTPromptAgent:
11
- """Генерирует промпт для GPT на основе анализа логов."""
12
-
13
- def __init__(self):
14
- """Инициализация агента."""
15
- pass
16
-
17
- def generate_prompt(
18
- self,
19
- structured_data: Dict[str, Any],
20
- anomaly_report: Dict[str, Any],
21
- recommendations: Optional[str] = None
22
- ) -> str:
23
- """
24
- Генерирует детальный промпт для GPT-модели.
25
-
26
- Args:
27
- structured_data: Структурированные данные от LogParserAgent
28
- anomaly_report: Отчёт об аномалиях от AnomalyDetectionAgent
29
- recommendations: Рекомендации от RootCauseAgent (опционально)
30
-
31
- Returns:
32
- Готовый промпт в виде строки для вставки в GPT
33
- """
34
- prompt_parts = []
35
-
36
- # Заголовок промпта
37
- prompt_parts.append("# Контекст проблемы из системных логов\n")
38
- prompt_parts.append("\nЯ анализирую логи системы и обнаружил несколько проблем. ")
39
- prompt_parts.append("Мне нужна помощь в диагностике и решении этих проблем.\n")
40
-
41
- # Раздел 1: Общая информация о системе
42
- prompt_parts.append("\n## 1. Информация о системе\n\n")
43
- system_info = self._extract_system_info(structured_data)
44
- prompt_parts.append(system_info)
45
-
46
- # Раздел 2: Обнаруженные проблемы
47
- prompt_parts.append("\n## 2. Обнаруженные проблемы и аномалии\n\n")
48
- problems_info = self._format_anomalies(anomaly_report)
49
- prompt_parts.append(problems_info)
50
-
51
- # Раздел 3: Статистика и метрики
52
- prompt_parts.append("\n## 3. Статистика событий\n\n")
53
- stats_info = self._format_statistics(structured_data, anomaly_report)
54
- prompt_parts.append(stats_info)
55
-
56
- # Раздел 4: Примеры ошибок и логов
57
- prompt_parts.append("\n## 4. Примеры ошибок и ключевые логи\n\n")
58
- examples_info = self._format_error_examples(structured_data, anomaly_report)
59
- prompt_parts.append(examples_info)
60
-
61
- # Раздел 5: Анализ первопричин (если есть рекомендации)
62
- if recommendations:
63
- prompt_parts.append("\n## 5. Предварительный анализ и рекомендации\n\n")
64
- prompt_parts.append(recommendations)
65
- prompt_parts.append("\n")
66
-
67
- # Раздел 6: Запрос к GPT
68
- prompt_parts.append("\n## 6. Запрос на решение\n\n")
69
- prompt_parts.append("Пожалуйста, помогите мне:\n")
70
- prompt_parts.append("1. Определить точную первопричину проблемы\n")
71
- prompt_parts.append("2. Предложить конкретные шаги для решения проблемы\n")
72
- prompt_parts.append("3. Предложить меры профилактики, чтобы избежать подобных проблем в будущем\n")
73
- prompt_parts.append("4. Если это программная ошибка, предложите патч или исправление кода (если возможно)\n")
74
- prompt_parts.append("5. Оцените критичность проблемы и приоритет решения\n\n")
75
-
76
- prompt_parts.append("Проанализируйте предоставленную информацию и дайте развёрнутый ответ с конкретными рекомендациями.\n")
77
-
78
- return "".join(prompt_parts)
79
-
80
- def _extract_system_info(self, structured_data: Dict[str, Any]) -> str:
81
- """Извлекает информацию о системе из структурированных данных."""
82
- info_parts = []
83
-
84
- statistics = structured_data.get('statistics', {})
85
- events = structured_data.get('events', [])
86
-
87
- # Временной диапазон
88
- time_range = statistics.get('time_range')
89
- if time_range:
90
- start_time = time_range.get('start') if isinstance(time_range, dict) else None
91
- end_time = time_range.get('end') if isinstance(time_range, dict) else None
92
- if start_time and end_time:
93
- info_parts.append(f"- **Временной диапазон логов:** с {start_time} по {end_time}\n")
94
- elif start_time:
95
- info_parts.append(f"- **Начало периода:** {start_time}\n")
96
-
97
- # Общая статистика
98
- total_lines = statistics.get('total_lines', 0)
99
- parsed_events = statistics.get('parsed_events', 0)
100
- errors_count = statistics.get('errors', 0)
101
- warnings_count = statistics.get('warnings', 0)
102
-
103
- info_parts.append(f"- **Всего строк в логах:** {total_lines}\n")
104
- info_parts.append(f"- **Распарсенных событий:** {parsed_events}\n")
105
- info_parts.append(f"- **Ошибок:** {errors_count}\n")
106
- info_parts.append(f"- **Предупреждений:** {warnings_count}\n")
107
-
108
- # Типы событий
109
- event_types = statistics.get('event_types', {})
110
- if event_types:
111
- info_parts.append(f"- **Типы событий в системе:**\n")
112
- for event_type, count in sorted(event_types.items(), key=lambda x: x[1], reverse=True)[:10]:
113
- info_parts.append(f" - {event_type}: {count} событий\n")
114
-
115
- # Попытка извлечь информацию о системе из логов
116
- system_info = self._extract_technical_details(events)
117
- if system_info:
118
- info_parts.append(f"\n### Технические детали системы:\n\n")
119
- info_parts.append(system_info)
120
-
121
- return "".join(info_parts) if info_parts else "Информация о системе не обнаружена в логах.\n"
122
-
123
- def _extract_technical_details(self, events: List[Dict]) -> str:
124
- """Извлекает технические детали из событий (версии, компоненты и т.д.)."""
125
- details = []
126
- seen_details = set()
127
-
128
- # Ключевые слова для поиска системной информации
129
- keywords = {
130
- 'version': ['version', 'версия', 'v.', 'ver '],
131
- 'component': ['component', 'компонент', 'module', 'модуль', 'service', 'сервис'],
132
- 'framework': ['framework', 'framework version', 'django', 'flask', 'spring', 'express'],
133
- 'database': ['database', 'db', 'mysql', 'postgresql', 'mongodb', 'redis'],
134
- 'os': ['linux', 'windows', 'ubuntu', 'centos', 'debian', 'os version'],
135
- 'language': ['python', 'java', 'node', 'javascript', 'typescript', 'go', 'rust'],
136
- 'protocol': ['http', 'https', 'tcp', 'udp', 'grpc']
137
- }
138
-
139
- for event in events[:200]: # Проверяем первые 200 событий
140
- message = event.get('message', '').lower()
141
- level = event.get('level', '').upper()
142
-
143
- # Извлекаем информацию о версиях и компонентах
144
- for detail_type, search_terms in keywords.items():
145
- for term in search_terms:
146
- if term in message and detail_type not in seen_details:
147
- # Пытаемся извлечь более конкретную информацию
148
- context = message[max(0, message.find(term) - 50):message.find(term) + 100]
149
- if context and len(context) > 10:
150
- details.append(f"- **{detail_type.upper()}:** обнаружен в логах (контекст: {context[:80]}...)\n")
151
- seen_details.add(detail_type)
152
- break
153
- if detail_type in seen_details:
154
- break
155
-
156
- return "".join(details) if details else "Специфические технические детали не обнаружены в логах.\n"
157
-
158
- def _format_anomalies(self, anomaly_report: Dict[str, Any]) -> str:
159
- """Форматирует информацию об аномалиях для промпта."""
160
- if not anomaly_report or not anomaly_report.get('anomalies'):
161
- return "Критических аномалий не обнаружено. Система работает в штатном режиме.\n"
162
-
163
- anomalies = anomaly_report.get('anomalies', [])
164
- statistics = anomaly_report.get('statistics', {})
165
- severity_summary = anomaly_report.get('severity_summary', {})
166
-
167
- info_parts = []
168
-
169
- # Общая сводка
170
- total_anomalies = statistics.get('total', 0)
171
- info_parts.append(f"**Всего обнаружено аномалий:** {total_anomalies}\n\n")
172
-
173
- # Сводка по серьёзности
174
- if severity_summary:
175
- info_parts.append("**Распределение по сер��ёзности:**\n")
176
- severity_names = {
177
- 'CRITICAL': '🔴 КРИТИЧЕСКИЕ',
178
- 'HIGH': '🟠 ВЫСОКИЕ',
179
- 'MEDIUM': '🟡 СРЕДНИЕ',
180
- 'LOW': '🟢 НИЗКИЕ'
181
- }
182
- for severity, count in sorted(severity_summary.items(), key=lambda x: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'].index(x[0]) if x[0] in ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'] else 999):
183
- name = severity_names.get(severity, severity)
184
- info_parts.append(f"- {name}: {count} проблем(ы)\n")
185
- info_parts.append("\n")
186
-
187
- # Детальное описание каждой аномалии
188
- info_parts.append("### Детальное описание проблем:\n\n")
189
-
190
- # Сортируем по серьёзности
191
- severity_order = {'CRITICAL': 0, 'HIGH': 1, 'MEDIUM': 2, 'LOW': 3}
192
- sorted_anomalies = sorted(
193
- anomalies,
194
- key=lambda x: severity_order.get(x.get('severity', 'LOW'), 999)
195
- )
196
-
197
- for i, anomaly in enumerate(sorted_anomalies, 1):
198
- anomaly_type = anomaly.get('type', 'UNKNOWN')
199
- severity = anomaly.get('severity', 'UNKNOWN')
200
- description = anomaly.get('description', 'Нет описания')
201
-
202
- info_parts.append(f"#### Проблема #{i}: {self._get_anomaly_type_name(anomaly_type)} ({severity})\n\n")
203
- info_parts.append(f"{description}\n\n")
204
-
205
- # Дополнительные детали
206
- if anomaly.get('count'):
207
- info_parts.append(f"- **Количество вхождений:** {anomaly.get('count')}\n")
208
-
209
- if anomaly.get('error_message'):
210
- error_msg = anomaly.get('error_message', '')[:300]
211
- info_parts.append(f"- **Сообщение об ошибке:** `{error_msg}`\n")
212
-
213
- if anomaly.get('sample_messages'):
214
- info_parts.append(f"- **Примеры сообщений:**\n")
215
- for msg in anomaly.get('sample_messages', [])[:3]:
216
- info_parts.append(f" - `{msg[:200]}`\n")
217
-
218
- if anomaly.get('time_window'):
219
- info_parts.append(f"- **Временное окно:** {anomaly.get('time_window')}\n")
220
-
221
- if anomaly.get('first_occurrence'):
222
- info_parts.append(f"- **Первое появление:** {anomaly.get('first_occurrence')}\n")
223
-
224
- if anomaly.get('last_occurrence'):
225
- info_parts.append(f"- **Последнее появление:** {anomaly.get('last_occurrence')}\n")
226
-
227
- if anomaly.get('metadata', {}).get('affected_lines'):
228
- lines = anomaly.get('metadata', {}).get('affected_lines', [])[:10]
229
- info_parts.append(f"- **Затронутые строки логов:** {', '.join(map(str, lines))}\n")
230
-
231
- info_parts.append("\n")
232
-
233
- return "".join(info_parts)
234
-
235
- def _format_statistics(self, structured_data: Dict[str, Any], anomaly_report: Dict[str, Any]) -> str:
236
- """Форматирует статистику для промпта."""
237
- stats_parts = []
238
-
239
- statistics = structured_data.get('statistics', {})
240
- anomaly_stats = anomaly_report.get('statistics', {})
241
-
242
- stats_parts.append("### Общая статистика событий:\n\n")
243
-
244
- total_lines = statistics.get('total_lines', 0)
245
- parsed_events = statistics.get('parsed_events', 0)
246
- errors = statistics.get('errors', 0)
247
- warnings = statistics.get('warnings', 0)
248
- info_count = statistics.get('info_messages', 0)
249
-
250
- if total_lines > 0:
251
- error_rate = (errors / parsed_events * 100) if parsed_events > 0 else 0
252
- warning_rate = (warnings / parsed_events * 100) if parsed_events > 0 else 0
253
-
254
- stats_parts.append(f"- **Всего строк логов:** {total_lines}\n")
255
- stats_parts.append(f"- **Распарсенных событий:** {parsed_events}\n")
256
- stats_parts.append(f"- **Ошибок:** {errors} ({error_rate:.2f}% от всех событий)\n")
257
- stats_parts.append(f"- **Предупреждений:** {warnings} ({warning_rate:.2f}% от всех событий)\n")
258
- stats_parts.append(f"- **Информационных сообщений:** {info_count}\n")
259
-
260
- if anomaly_stats:
261
- stats_parts.append(f"\n### Статистика аномалий:\n\n")
262
- by_type = anomaly_stats.get('by_type', {})
263
- if by_type:
264
- stats_parts.append("**По типам:**\n")
265
- for anomaly_type, count in sorted(by_type.items(), key=lambda x: x[1], reverse=True):
266
- type_name = self._get_anomaly_type_name(anomaly_type)
267
- stats_parts.append(f"- {type_name}: {count}\n")
268
-
269
- return "".join(stats_parts)
270
-
271
- def _format_error_examples(self, structured_data: Dict[str, Any], anomaly_report: Dict[str, Any]) -> str:
272
- """Форматирует примеры ошибок для промпта."""
273
- examples_parts = []
274
-
275
- errors = structured_data.get('errors', [])
276
- anomalies = anomaly_report.get('anomalies', [])
277
-
278
- if not errors:
279
- return "Явных ошибок в логах не обнаружено.\n"
280
-
281
- examples_parts.append("### Ключевые ошибки из логов:\n\n")
282
-
283
- # Показываем уникальные ошибки (первые 10)
284
- unique_errors = []
285
- seen_messages = set()
286
-
287
- for error in errors[:50]:
288
- message = error.get('message', '').strip()
289
- if message and message not in seen_messages:
290
- unique_errors.append(error)
291
- seen_messages.add(message)
292
- if len(unique_errors) >= 10:
293
- break
294
-
295
- for i, error in enumerate(unique_errors, 1):
296
- level = error.get('level', 'UNKNOWN')
297
- message = error.get('message', '')[:400]
298
- timestamp = error.get('timestamp', 'N/A')
299
- line_num = error.get('line_number', 'N/A')
300
-
301
- examples_parts.append(f"**Ошибка #{i}** (уровень: {level}, строка: {line_num}, время: {timestamp}):\n")
302
- examples_parts.append(f"```\n{message}\n```\n\n")
303
-
304
- # Если есть примеры из аномалий, добавляем их
305
- if anomalies:
306
- examples_parts.append("### Примеры проблемных паттернов из аномалий:\n\n")
307
- for anomaly in anomalies[:5]:
308
- if anomaly.get('sample_messages'):
309
- examples_parts.append(f"**{self._get_anomaly_type_name(anomaly.get('type'))}:**\n")
310
- for msg in anomaly.get('sample_messages', [])[:2]:
311
- examples_parts.append(f"- `{msg[:200]}`\n")
312
- examples_parts.append("\n")
313
-
314
- return "".join(examples_parts)
315
-
316
- def _get_anomaly_type_name(self, anomaly_type: str) -> str:
317
- """Возвращает читаемое имя типа аномалии."""
318
- names = {
319
- 'BURST_ERRORS': 'Всплеск ошибок (Burst Errors)',
320
- 'REPEATED_ERRORS': 'Повторяющиеся ошибки (Repeated Errors)',
321
- 'ERROR_BEFORE_CRASH': 'Ошибка перед крашем (Error Before Crash)',
322
- 'TEMPORAL_SPIKE': 'Временной всплеск событий (Temporal Spike)',
323
- 'REPEATED_STACK_TRACES': 'Повторяющиеся stack traces (Repeated Stack Traces)',
324
- }
325
- return names.get(anomaly_type, anomaly_type)
 
1
+ """
2
+ Agent 4: GPT Prompt Generator Agent
3
+ Формирует детальный промпт для GPT-модели с полным контекстом проблемы и системы.
4
+ """
5
+
6
+ from typing import Dict, List, Any, Optional
7
+ from datetime import datetime
8
+
9
+
10
+ class GPTPromptAgent:
11
+ """Генерирует промпт для GPT на основе анализа логов."""
12
+
13
+ def __init__(self):
14
+ """Инициализация агента."""
15
+ pass
16
+
17
+ def generate_prompt(
18
+ self,
19
+ structured_data: Dict[str, Any],
20
+ anomaly_report: Dict[str, Any],
21
+ recommendations: Optional[str] = None
22
+ ) -> str:
23
+ """
24
+ Генерирует детальный промпт для GPT-модели.
25
+
26
+ Args:
27
+ structured_data: Структурированные данные от LogParserAgent
28
+ anomaly_report: Отчёт об аномалиях от AnomalyDetectionAgent
29
+ recommendations: Рекомендации от RootCauseAgent (опционально)
30
+
31
+ Returns:
32
+ Готовый промпт в виде строки для вставки в GPT
33
+ """
34
+ prompt_parts = []
35
+
36
+ # Заголовок промпта
37
+ prompt_parts.append("# Контекст проблемы из системных логов\n")
38
+ prompt_parts.append("\nЯ анализирую логи системы и обнаружил несколько проблем. ")
39
+ prompt_parts.append("Мне нужна помощь в диагностике и решении этих проблем.\n")
40
+
41
+ # Раздел 1: Общая информация о системе
42
+ prompt_parts.append("\n## 1. Информация о системе\n\n")
43
+ system_info = self._extract_system_info(structured_data)
44
+ prompt_parts.append(system_info)
45
+
46
+ # Раздел 2: Обнаруженные проблемы
47
+ prompt_parts.append("\n## 2. Обнаруженные проблемы и аномалии\n\n")
48
+ problems_info = self._format_anomalies(anomaly_report)
49
+ prompt_parts.append(problems_info)
50
+
51
+ # Раздел 3: Статистика и метрики
52
+ prompt_parts.append("\n## 3. Статистика событий\n\n")
53
+ stats_info = self._format_statistics(structured_data, anomaly_report)
54
+ prompt_parts.append(stats_info)
55
+
56
+ # Раздел 4: Примеры ошибок и логов
57
+ prompt_parts.append("\n## 4. Примеры ошибок и ключевые логи\n\n")
58
+ examples_info = self._format_error_examples(structured_data, anomaly_report)
59
+ prompt_parts.append(examples_info)
60
+
61
+ # Раздел 5: Анализ первопричин (если есть рекомендации)
62
+ if recommendations:
63
+ prompt_parts.append("\n## 5. Предварительный анализ и рекомендации\n\n")
64
+ prompt_parts.append(recommendations)
65
+ prompt_parts.append("\n")
66
+
67
+ # Раздел 6: Запрос к GPT
68
+ prompt_parts.append("\n## 6. Запрос на решение\n\n")
69
+ prompt_parts.append("Пожалуйста, помогите мне:\n")
70
+ prompt_parts.append("1. Определить точную первопричину проблемы\n")
71
+ prompt_parts.append("2. Предложить конкретные шаги для решения проблемы\n")
72
+ prompt_parts.append("3. Предложить меры профилактики, чтобы избежать подобных проблем в будущем\n")
73
+ prompt_parts.append("4. Если это программная ошибка, предложите патч или исправление кода (если возможно)\n")
74
+ prompt_parts.append("5. Оцените критичность проблемы и приоритет решения\n\n")
75
+
76
+ prompt_parts.append("Проанализируйте предоставленную информацию и дайте развёрнутый ответ с конкретными рекомендациями.\n")
77
+
78
+ return "".join(prompt_parts)
79
+
80
+ def _extract_system_info(self, structured_data: Dict[str, Any]) -> str:
81
+ """Извлекает информацию о системе из структурированных данных."""
82
+ info_parts = []
83
+
84
+ statistics = structured_data.get('statistics', {})
85
+ events = structured_data.get('events', [])
86
+
87
+ # Временной диапазон
88
+ time_range = statistics.get('time_range')
89
+ if time_range:
90
+ start_time = time_range.get('start') if isinstance(time_range, dict) else None
91
+ end_time = time_range.get('end') if isinstance(time_range, dict) else None
92
+ if start_time and end_time:
93
+ info_parts.append(f"- **Временной диапазон логов:** с {start_time} по {end_time}\n")
94
+ elif start_time:
95
+ info_parts.append(f"- **Начало периода:** {start_time}\n")
96
+
97
+ # Общая статистика
98
+ total_lines = statistics.get('total_lines', 0)
99
+ parsed_events = statistics.get('parsed_events', 0)
100
+ errors_count = statistics.get('errors', 0)
101
+ warnings_count = statistics.get('warnings', 0)
102
+
103
+ info_parts.append(f"- **Всего строк в логах:** {total_lines}\n")
104
+ info_parts.append(f"- **Распарсенных событий:** {parsed_events}\n")
105
+ info_parts.append(f"- **Ошибок:** {errors_count}\n")
106
+ info_parts.append(f"- **Предупреждений:** {warnings_count}\n")
107
+
108
+ # Типы событий
109
+ event_types = statistics.get('event_types', {})
110
+ if event_types:
111
+ info_parts.append(f"- **Типы событий в системе:**\n")
112
+ for event_type, count in sorted(event_types.items(), key=lambda x: x[1], reverse=True)[:10]:
113
+ info_parts.append(f" - {event_type}: {count} событий\n")
114
+
115
+ # Попытка извлечь информацию о системе из логов
116
+ system_info = self._extract_technical_details(events)
117
+ if system_info:
118
+ info_parts.append(f"\n### Технические детали системы:\n\n")
119
+ info_parts.append(system_info)
120
+
121
+ return "".join(info_parts) if info_parts else "Информация о системе не обнаружена в логах.\n"
122
+
123
+ def _extract_technical_details(self, events: List[Dict]) -> str:
124
+ """Извлекает технические детали из событий (версии, компоненты и т.д.)."""
125
+ details = []
126
+ seen_details = set()
127
+
128
+ # Ключевые слова для поиска системной информации
129
+ keywords = {
130
+ 'version': ['version', 'версия', 'v.', 'ver '],
131
+ 'component': ['component', 'компонент', 'module', 'модуль', 'service', 'сервис'],
132
+ 'framework': ['framework', 'framework version', 'django', 'flask', 'spring', 'express'],
133
+ 'database': ['database', 'db', 'mysql', 'postgresql', 'mongodb', 'redis'],
134
+ 'os': ['linux', 'windows', 'ubuntu', 'centos', 'debian', 'os version'],
135
+ 'language': ['python', 'java', 'node', 'javascript', 'typescript', 'go', 'rust'],
136
+ 'protocol': ['http', 'https', 'tcp', 'udp', 'grpc']
137
+ }
138
+
139
+ for event in events[:200]: # Проверяем первые 200 событий
140
+ message = event.get('message', '').lower()
141
+ level = event.get('level', '').upper()
142
+
143
+ # Извлекаем информацию о версиях и компонентах
144
+ for detail_type, search_terms in keywords.items():
145
+ for term in search_terms:
146
+ if term in message and detail_type not in seen_details:
147
+ # Пытаемся извлечь более конкретную информацию
148
+ context = message[max(0, message.find(term) - 50):message.find(term) + 100]
149
+ if context and len(context) > 10:
150
+ details.append(f"- **{detail_type.upper()}:** обнаружен в логах (контекст: {context[:80]}...)\n")
151
+ seen_details.add(detail_type)
152
+ break
153
+ if detail_type in seen_details:
154
+ break
155
+
156
+ return "".join(details) if details else "Специфические технические детали не обнаружены в логах.\n"
157
+
158
+ def _format_anomalies(self, anomaly_report: Dict[str, Any]) -> str:
159
+ """Форматирует информацию об аномалиях для промпта."""
160
+ if not anomaly_report or not anomaly_report.get('anomalies'):
161
+ return "Критических аномалий не обнаружено. Система работает в штатном режиме.\n"
162
+
163
+ anomalies = anomaly_report.get('anomalies', [])
164
+ statistics = anomaly_report.get('statistics', {})
165
+ severity_summary = anomaly_report.get('severity_summary', {})
166
+
167
+ info_parts = []
168
+
169
+ # Общая сводка
170
+ total_anomalies = statistics.get('total', 0)
171
+ info_parts.append(f"**Всего обнаружено аномалий:** {total_anomalies}\n\n")
172
+
173
+ # Сводка по серьёзности
174
+ if severity_summary:
175
+ info_parts.append("**Распределение по серьёзности:**\n")
176
+ severity_names = {
177
+ 'CRITICAL': '🔴 КРИТИЧЕСКИЕ',
178
+ 'HIGH': '🟠 ВЫСОКИЕ',
179
+ 'MEDIUM': '🟡 СРЕДНИЕ',
180
+ 'LOW': '🟢 НИЗКИЕ'
181
+ }
182
+ for severity, count in sorted(severity_summary.items(), key=lambda x: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'].index(x[0]) if x[0] in ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'] else 999):
183
+ name = severity_names.get(severity, severity)
184
+ info_parts.append(f"- {name}: {count} проблем(ы)\n")
185
+ info_parts.append("\n")
186
+
187
+ # Детальное описание каждой аномалии
188
+ info_parts.append("### Детальное описание проблем:\n\n")
189
+
190
+ # Сортируем по серьёзности
191
+ severity_order = {'CRITICAL': 0, 'HIGH': 1, 'MEDIUM': 2, 'LOW': 3}
192
+ sorted_anomalies = sorted(
193
+ anomalies,
194
+ key=lambda x: severity_order.get(x.get('severity', 'LOW'), 999)
195
+ )
196
+
197
+ for i, anomaly in enumerate(sorted_anomalies, 1):
198
+ anomaly_type = anomaly.get('type', 'UNKNOWN')
199
+ severity = anomaly.get('severity', 'UNKNOWN')
200
+ description = anomaly.get('description', 'Нет описания')
201
+
202
+ info_parts.append(f"#### Проблема #{i}: {self._get_anomaly_type_name(anomaly_type)} ({severity})\n\n")
203
+ info_parts.append(f"{description}\n\n")
204
+
205
+ # Дополнительные детали
206
+ if anomaly.get('count'):
207
+ info_parts.append(f"- **Количество вхождений:** {anomaly.get('count')}\n")
208
+
209
+ if anomaly.get('error_message'):
210
+ error_msg = anomaly.get('error_message', '')[:300]
211
+ info_parts.append(f"- **Сообщение об ошибке:** `{error_msg}`\n")
212
+
213
+ if anomaly.get('sample_messages'):
214
+ info_parts.append(f"- **Примеры сообщений:**\n")
215
+ for msg in anomaly.get('sample_messages', [])[:3]:
216
+ info_parts.append(f" - `{msg[:200]}`\n")
217
+
218
+ if anomaly.get('time_window'):
219
+ info_parts.append(f"- **Временное окно:** {anomaly.get('time_window')}\n")
220
+
221
+ if anomaly.get('first_occurrence'):
222
+ info_parts.append(f"- **Первое появление:** {anomaly.get('first_occurrence')}\n")
223
+
224
+ if anomaly.get('last_occurrence'):
225
+ info_parts.append(f"- **Последнее появление:** {anomaly.get('last_occurrence')}\n")
226
+
227
+ if anomaly.get('metadata', {}).get('affected_lines'):
228
+ lines = anomaly.get('metadata', {}).get('affected_lines', [])[:10]
229
+ info_parts.append(f"- **Затронутые строки логов:** {', '.join(map(str, lines))}\n")
230
+
231
+ info_parts.append("\n")
232
+
233
+ return "".join(info_parts)
234
+
235
+ def _format_statistics(self, structured_data: Dict[str, Any], anomaly_report: Dict[str, Any]) -> str:
236
+ """Форматирует статистику для промпта."""
237
+ stats_parts = []
238
+
239
+ statistics = structured_data.get('statistics', {})
240
+ anomaly_stats = anomaly_report.get('statistics', {})
241
+
242
+ stats_parts.append("### Общая статистика событий:\n\n")
243
+
244
+ total_lines = statistics.get('total_lines', 0)
245
+ parsed_events = statistics.get('parsed_events', 0)
246
+ errors = statistics.get('errors', 0)
247
+ warnings = statistics.get('warnings', 0)
248
+ info_count = statistics.get('info_messages', 0)
249
+
250
+ if total_lines > 0:
251
+ error_rate = (errors / parsed_events * 100) if parsed_events > 0 else 0
252
+ warning_rate = (warnings / parsed_events * 100) if parsed_events > 0 else 0
253
+
254
+ stats_parts.append(f"- **Всего строк логов:** {total_lines}\n")
255
+ stats_parts.append(f"- **Распарсенных событий:** {parsed_events}\n")
256
+ stats_parts.append(f"- **Ошибок:** {errors} ({error_rate:.2f}% от всех событий)\n")
257
+ stats_parts.append(f"- **Предупреждений:** {warnings} ({warning_rate:.2f}% от всех событий)\n")
258
+ stats_parts.append(f"- **Информационных сообщений:** {info_count}\n")
259
+
260
+ if anomaly_stats:
261
+ stats_parts.append(f"\n### Статистика аномалий:\n\n")
262
+ by_type = anomaly_stats.get('by_type', {})
263
+ if by_type:
264
+ stats_parts.append("**По типам:**\n")
265
+ for anomaly_type, count in sorted(by_type.items(), key=lambda x: x[1], reverse=True):
266
+ type_name = self._get_anomaly_type_name(anomaly_type)
267
+ stats_parts.append(f"- {type_name}: {count}\n")
268
+
269
+ return "".join(stats_parts)
270
+
271
+ def _format_error_examples(self, structured_data: Dict[str, Any], anomaly_report: Dict[str, Any]) -> str:
272
+ """Форматирует примеры ошибок для промпта."""
273
+ examples_parts = []
274
+
275
+ errors = structured_data.get('errors', [])
276
+ anomalies = anomaly_report.get('anomalies', [])
277
+
278
+ if not errors:
279
+ return "Явных ошибок в логах не обнаружено.\n"
280
+
281
+ examples_parts.append("### Ключевые ошибки из логов:\n\n")
282
+
283
+ # Показываем уникальные ошибки (первые 10)
284
+ unique_errors = []
285
+ seen_messages = set()
286
+
287
+ for error in errors[:50]:
288
+ message = error.get('message', '').strip()
289
+ if message and message not in seen_messages:
290
+ unique_errors.append(error)
291
+ seen_messages.add(message)
292
+ if len(unique_errors) >= 10:
293
+ break
294
+
295
+ for i, error in enumerate(unique_errors, 1):
296
+ level = error.get('level', 'UNKNOWN')
297
+ message = error.get('message', '')[:400]
298
+ timestamp = error.get('timestamp', 'N/A')
299
+ line_num = error.get('line_number', 'N/A')
300
+
301
+ examples_parts.append(f"**Ошибка #{i}** (уровень: {level}, строка: {line_num}, время: {timestamp}):\n")
302
+ examples_parts.append(f"```\n{message}\n```\n\n")
303
+
304
+ # Если есть пример�� из аномалий, добавляем их
305
+ if anomalies:
306
+ examples_parts.append("### Примеры проблемных паттернов из аномалий:\n\n")
307
+ for anomaly in anomalies[:5]:
308
+ if anomaly.get('sample_messages'):
309
+ examples_parts.append(f"**{self._get_anomaly_type_name(anomaly.get('type'))}:**\n")
310
+ for msg in anomaly.get('sample_messages', [])[:2]:
311
+ examples_parts.append(f"- `{msg[:200]}`\n")
312
+ examples_parts.append("\n")
313
+
314
+ return "".join(examples_parts)
315
+
316
+ def _get_anomaly_type_name(self, anomaly_type: str) -> str:
317
+ """Возвращает читаемое имя типа аномалии."""
318
+ names = {
319
+ 'BURST_ERRORS': 'Всплеск ошибок (Burst Errors)',
320
+ 'REPEATED_ERRORS': 'Повторяющиеся ошибки (Repeated Errors)',
321
+ 'ERROR_BEFORE_CRASH': 'Ошибка перед крашем (Error Before Crash)',
322
+ 'TEMPORAL_SPIKE': 'Временной всплеск событий (Temporal Spike)',
323
+ 'REPEATED_STACK_TRACES': 'Повторяющиеся stack traces (Repeated Stack Traces)',
324
+ }
325
+ return names.get(anomaly_type, anomaly_type)
app.py CHANGED
@@ -1,91 +1,85 @@
1
  """
2
  Gradio приложение для мультиагентной системы анализа логов.
3
- Оркестрирует работу трёх агентов и предоставляет веб-интерфейс.
4
  """
5
 
6
  import gradio as gr
7
  import json
8
  import os
9
- from typing import Tuple, Dict, Any
10
 
11
- from agents import LogParserAgent, AnomalyDetectionAgent, RootCauseAgent, GPTPromptAgent
12
 
 
 
13
 
14
- class LogAnalysisOrchestrator:
15
- """Оркестратор для последовательного выполнения агентов."""
 
 
 
 
 
16
 
17
- def __init__(self):
18
- """Инициализация оркестратора и агентов."""
19
- self.parser_agent = LogParserAgent()
20
- self.anomaly_agent = AnomalyDetectionAgent()
21
- self.rca_agent = RootCauseAgent()
22
- self.gpt_prompt_agent = GPTPromptAgent()
23
 
24
- def analyze(self, raw_logs: str) -> Tuple[str, str, str, str]:
25
- """
26
- Выполняет полный цикл анализа логов через всех агентов.
27
-
28
- Args:
29
- raw_logs: Сырые логи в виде строки
30
-
31
- Returns:
32
- Кортеж из четырёх строк:
33
- - JSON строка с распарсенными логами (для gr.Code)
34
- - JSON строка с обнаруженными аномалиями (для gr.Code)
35
- - Markdown строка с рекомендациями (для gr.Markdown)
36
- - Текст промпта для GPT (для gr.Textbox)
37
- """
38
- try:
39
- # Валидация входных данных
40
- if not raw_logs or not raw_logs.strip():
41
- error_json = json.dumps({"error": "Логи не предоставлены"}, ensure_ascii=False, indent=2)
42
- error_prompt = "# Ошибка\n\nЛоги не предоставлены для анализа."
43
- return error_json, error_json, "# Ошибка\n\nЛоги не предоставлены для анализа.", error_prompt
44
 
45
- # Agent 1: Парсинг логов
46
- try:
47
- structured_data = self.parser_agent.parse(raw_logs)
48
- parsed_json = json.dumps(structured_data, ensure_ascii=False, indent=2)
49
- except Exception as e:
50
- error_json = json.dumps({"error": f"Ошибка парсинга логов: {str(e)}"}, ensure_ascii=False, indent=2)
51
- error_prompt = f"# Ошибка\n\nОшибка на этапе парсинга: {str(e)}"
52
- return error_json, error_json, f"# Ошибка\n\nОшибка на этапе парсинга: {str(e)}", error_prompt
53
 
54
- # Agent 2: Обнаружение аномалий
55
- try:
56
- anomaly_report = self.anomaly_agent.detect(structured_data)
57
- anomalies_json = json.dumps(anomaly_report, ensure_ascii=False, indent=2)
58
- except Exception as e:
59
- error_json = json.dumps({"error": f"Ошибка обнаружения аномалий: {str(e)}"}, ensure_ascii=False, indent=2)
60
- error_prompt = f"# Ошибка\n\nОшибка на этапе обнаружения аномалий: {str(e)}"
61
- return parsed_json, error_json, f"# Ошибка\n\nОшибка на этапе обнаружения аномалий: {str(e)}", error_prompt
 
 
 
 
 
 
62
 
63
- # Agent 3: Анализ первопричин и рекомендации
64
- try:
65
- recommendations_md = self.rca_agent.analyze(anomaly_report)
66
- except Exception as e:
67
- recommendations_md = f"# Ошибка\n\nОшибка на этапе анализа первопричин: {str(e)}"
68
 
69
- # Agent 4: Генерация промпта для GPT
70
- try:
71
- gpt_prompt = self.gpt_prompt_agent.generate_prompt(
72
- structured_data,
73
- anomaly_report,
74
- recommendations_md
75
- )
76
- except Exception as e:
77
- gpt_prompt = f"# Ошибка генерации промпта\n\nПроизошла ошибка при генерации промпта для GPT: {str(e)}\n\nПопробуйте использовать информацию из других вкладок."
78
 
79
- return parsed_json, anomalies_json, recommendations_md, gpt_prompt
80
-
81
- except Exception as e:
82
- error_json = json.dumps({"error": f"Критическая ошибка: {str(e)}"}, ensure_ascii=False, indent=2)
83
- error_prompt = f"# Критическая ошибка\n\n{str(e)}"
84
- return error_json, error_json, f"# Критическая ошибка\n\n{str(e)}", error_prompt
85
-
86
-
87
- # Глобальный экземпляр оркестратора
88
- orchestrator = LogAnalysisOrchestrator()
 
 
 
 
89
 
90
 
91
  def analyze_logs(raw_logs: str) -> Tuple[str, str, str, str]:
@@ -102,7 +96,55 @@ def analyze_logs(raw_logs: str) -> Tuple[str, str, str, str]:
102
  - Рекомендации (Markdown)
103
  - Промпт для GPT (текст)
104
  """
105
- return orchestrator.analyze(raw_logs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
 
108
  def create_interface():
@@ -112,10 +154,10 @@ def create_interface():
112
  description = """
113
  # 🔍 Мультиагентная система анализа логов
114
 
115
- Система использует четырех независимых агентов для анализа логов:
116
- 1. **Log Parser Agent** - парсит и структурирует логи
117
- 2. **Anomaly Detection Agent** - обнаруживает аномалии и паттерны
118
- 3. **Root Cause Agent** - анализирует первопричины и генерирует рекомендации
119
  4. **GPT Prompt Agent** - формирует готовый промпт для GPT-моделей с полным контекстом проблемы
120
 
121
  Вставьте логи в поле ниже или загрузите лог-файл, затем нажмите "Анализировать".
@@ -239,23 +281,16 @@ def create_interface():
239
  ---
240
  ### ℹ️ Информация о системе
241
 
242
- - **Архитектура:** Мультиагентная система (4 независимых агента)
243
  - **Платформа:** Hugging Face Spaces
244
  - **Интерфейс:** Gradio
245
  - **Поддержка:** До 10,000 строк логов
246
  - **Интеграция:** Генерация промптов для GPT-моделей
 
247
  """)
248
-
249
- return app
250
 
251
- def env_flag(name: str, default: bool = False) -> bool:
252
- """
253
- Безопасно читает булевы переменные окружения (1/0, true/false и т.д.).
254
- """
255
- raw = os.getenv(name)
256
- if raw is None:
257
- return default
258
- return raw.lower() in ("1", "true", "yes", "on")
259
 
260
  # Создание приложения
261
  demo = create_interface()
@@ -273,4 +308,4 @@ if __name__ == "__main__":
273
  server_port=port,
274
  share=share_flag,
275
  show_api=False,
276
- )
 
1
  """
2
  Gradio приложение для мультиагентной системы анализа логов.
3
+ Оркестрирует работу агентов на основе smolagents и предоставляет веб-интерфейс.
4
  """
5
 
6
  import gradio as gr
7
  import json
8
  import os
9
+ from typing import Tuple
10
 
11
+ from agents import run_parser_agent, run_anomaly_agent, run_rca_agent
12
 
13
+ # Импорт GPT Prompt Agent (остаётся rule-based, не использует трансформеры)
14
+ from agents.gpt_prompt_agent import GPTPromptAgent
15
 
16
+ # Инициализация GPT Prompt Agent (остаётся rule-based)
17
+ gpt_prompt_agent = GPTPromptAgent()
18
+
19
+
20
+ def format_rca_as_markdown(rca_result: dict) -> str:
21
+ """Форматирует результат RCA агента в Markdown."""
22
+ markdown_parts = []
23
 
24
+ markdown_parts.append("# Анализ первопричин и рекомендации\n")
 
 
 
 
 
25
 
26
+ # Анализ первопричин
27
+ analysis = rca_result.get("analysis", {})
28
+ root_causes = analysis.get("root_causes", [])
29
+ details = analysis.get("details", [])
30
+
31
+ if root_causes:
32
+ markdown_parts.append("\n## Возможные первопричины\n\n")
33
+ for i, cause in enumerate(root_causes, 1):
34
+ markdown_parts.append(f"{i}. {cause}\n")
35
+
36
+ # Детали по типам аномалий
37
+ if details:
38
+ markdown_parts.append("\n## Детальный анализ аномалий\n\n")
39
+ for detail in details:
40
+ anomaly_type = detail.get("anomaly_type", "UNKNOWN")
41
+ severity = detail.get("severity", "UNKNOWN")
42
+ description = detail.get("description", "")
43
+ possible_causes = detail.get("possible_causes", [])
 
 
44
 
45
+ markdown_parts.append(f"### {anomaly_type} ({severity})\n\n")
46
+ markdown_parts.append(f"{description}\n\n")
 
 
 
 
 
 
47
 
48
+ if possible_causes:
49
+ markdown_parts.append("#### Возможные первопричины:\n\n")
50
+ for i, cause in enumerate(possible_causes, 1):
51
+ markdown_parts.append(f"{i}. {cause}\n")
52
+ markdown_parts.append("\n")
53
+
54
+ # Рекомендации
55
+ recommendations = rca_result.get("recommendations", [])
56
+ if recommendations:
57
+ markdown_parts.append("\n## Рекомендации по устранению\n\n")
58
+ for i, rec in enumerate(recommendations, 1):
59
+ priority = rec.get("priority", "MEDIUM")
60
+ text = rec.get("text", "")
61
+ actions = rec.get("actions", [])
62
 
63
+ emoji_map = {"CRITICAL": "🔴", "HIGH": "🟠", "MEDIUM": "🟡", "LOW": "🟢"}
64
+ emoji = emoji_map.get(priority, "⚪")
 
 
 
65
 
66
+ markdown_parts.append(f"### {emoji} Рекомендация {i} (Приоритет: {priority})\n\n")
67
+ markdown_parts.append(f"{text}\n\n")
 
 
 
 
 
 
 
68
 
69
+ if actions:
70
+ markdown_parts.append("**Конкретные действия:**\n\n")
71
+ for action in actions:
72
+ markdown_parts.append(f"- {action}\n")
73
+ markdown_parts.append("\n")
74
+
75
+ # Общие рекомендации
76
+ general = rca_result.get("general_recommendations", [])
77
+ if general:
78
+ markdown_parts.append("\n## Общие рекомендации\n\n")
79
+ for rec in general:
80
+ markdown_parts.append(f"- {rec}\n")
81
+
82
+ return "".join(markdown_parts)
83
 
84
 
85
  def analyze_logs(raw_logs: str) -> Tuple[str, str, str, str]:
 
96
  - Рекомендации (Markdown)
97
  - Промпт для GPT (текст)
98
  """
99
+ try:
100
+ # Валидация входных данных
101
+ if not raw_logs or not raw_logs.strip():
102
+ error_json = json.dumps({"error": "Логи не предоставлены"}, ensure_ascii=False, indent=2)
103
+ error_prompt = "# Ошибка\n\nЛоги не предоставлены для анализа."
104
+ return error_json, error_json, "# Ошибка\n\nЛоги не предоставлены для анализа.", error_prompt
105
+
106
+ # Agent 1: Парсинг логов
107
+ try:
108
+ structured_data = run_parser_agent(raw_logs)
109
+ parsed_json = json.dumps(structured_data, ensure_ascii=False, indent=2)
110
+ except Exception as e:
111
+ error_json = json.dumps({"error": f"Ошибка парсинга логов: {str(e)}"}, ensure_ascii=False, indent=2)
112
+ error_prompt = f"# Ошибка\n\nОшибка на этапе парсинга: {str(e)}"
113
+ return error_json, error_json, f"# Ошибка\n\nОшибка на этапе парсинга: {str(e)}", error_prompt
114
+
115
+ # Agent 2: Обнаружение аномалий
116
+ try:
117
+ anomaly_report = run_anomaly_agent(structured_data)
118
+ anomalies_json = json.dumps(anomaly_report, ensure_ascii=False, indent=2)
119
+ except Exception as e:
120
+ error_json = json.dumps({"error": f"Ошибка обнаружения аномалий: {str(e)}"}, ensure_ascii=False, indent=2)
121
+ error_prompt = f"# Ошибка\n\nОшибка на этапе обнаружения аномалий: {str(e)}"
122
+ return parsed_json, error_json, f"# Ошибка\n\nОшибка на этапе обнаружения аномалий: {str(e)}", error_prompt
123
+
124
+ # Agent 3: Анализ первопричин и рекомендации
125
+ try:
126
+ rca_result = run_rca_agent(anomaly_report)
127
+ recommendations_md = format_rca_as_markdown(rca_result)
128
+ except Exception as e:
129
+ recommendations_md = f"# Ошибка\n\nОшибка на этапе анализа первопричин: {str(e)}"
130
+ rca_result = {}
131
+
132
+ # Agent 4: Генерация промпта для GPT
133
+ try:
134
+ gpt_prompt = gpt_prompt_agent.generate_prompt(
135
+ structured_data,
136
+ anomaly_report,
137
+ recommendations_md
138
+ )
139
+ except Exception as e:
140
+ gpt_prompt = f"# Ошибка генерации промпта\n\nПроизошла ошибка при генерации промпта для GPT: {str(e)}\n\nПопробуйте использовать информацию из других вкладок."
141
+
142
+ return parsed_json, anomalies_json, recommendations_md, gpt_prompt
143
+
144
+ except Exception as e:
145
+ error_json = json.dumps({"error": f"Критическая ошибка: {str(e)}"}, ensure_ascii=False, indent=2)
146
+ error_prompt = f"# Критическая ошибка\n\n{str(e)}"
147
+ return error_json, error_json, f"# Критическая ошибка\n\n{str(e)}", error_prompt
148
 
149
 
150
  def create_interface():
 
154
  description = """
155
  # 🔍 Мультиагентная система анализа логов
156
 
157
+ Система использует четырёх независимых агентов на основе трансформеров для анализа логов:
158
+ 1. **Log Parser Agent** - парсит и структурирует логи с помощью ИИ
159
+ 2. **Anomaly Detection Agent** - обнаруживает аномалии и паттерны с помощью ИИ
160
+ 3. **Root Cause Agent** - анализирует первопричины и генерирует рекомендации с помощью ИИ
161
  4. **GPT Prompt Agent** - формирует готовый промпт для GPT-моделей с полным контекстом проблемы
162
 
163
  Вставьте логи в поле ниже или загрузите лог-файл, затем нажмите "Анализировать".
 
281
  ---
282
  ### ℹ️ Информация о системе
283
 
284
+ - **Архитектура:** Мультиагентная система (4 независимых агента на основе трансформеров)
285
  - **Платформа:** Hugging Face Spaces
286
  - **Интерфейс:** Gradio
287
  - **Поддержка:** До 10,000 строк логов
288
  - **Интеграция:** Генерация промптов для GPT-моделей
289
+ - **Модель:** DeepSeek-V3.1-Terminus (через smolagents)
290
  """)
291
+
292
+ return app
293
 
 
 
 
 
 
 
 
 
294
 
295
  # Создание приложения
296
  demo = create_interface()
 
308
  server_port=port,
309
  share=share_flag,
310
  show_api=False,
311
+ )
requirements.txt CHANGED
@@ -1,2 +1,4 @@
1
- gradio==5.23.1
2
- pydantic==2.10.6
 
 
 
1
+ gradio==5.23.1
2
+ pydantic==2.10.6
3
+ smolagents
4
+ jsonschema
schemas/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # schemas/__init__.py
2
+ from .schemas import parser_schema, anomaly_schema, rca_schema
3
+
4
+ __all__ = ['parser_schema', 'anomaly_schema', 'rca_schema']
schemas/__pycache__/schemas.cpython-314.pyc ADDED
Binary file (2.13 kB). View file
 
schemas/schemas.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # schemas/schemas.py
2
+ # Схемы для валидации выходных данных агентов анализа логов
3
+
4
+ parser_schema = {
5
+ "type": "object",
6
+ "properties": {
7
+ "events": {
8
+ "type": "array",
9
+ "items": {
10
+ "type": "object",
11
+ "properties": {
12
+ "line_number": {"type": "integer"},
13
+ "timestamp": {"type": ["string", "null"]},
14
+ "level": {"type": "string"},
15
+ "message": {"type": "string"},
16
+ "type": {"type": "string"}
17
+ },
18
+ "required": ["line_number", "level", "message"]
19
+ }
20
+ },
21
+ "errors": {
22
+ "type": "array",
23
+ "items": {"type": "object"}
24
+ },
25
+ "warnings": {
26
+ "type": "array",
27
+ "items": {"type": "object"}
28
+ },
29
+ "statistics": {
30
+ "type": "object",
31
+ "properties": {
32
+ "total_lines": {"type": "integer"},
33
+ "parsed_events": {"type": "integer"},
34
+ "errors": {"type": "integer"},
35
+ "warnings": {"type": "integer"},
36
+ "info_messages": {"type": "integer"},
37
+ "event_types": {"type": "object"},
38
+ "time_range": {
39
+ "type": ["object", "null"],
40
+ "properties": {
41
+ "start": {"type": ["string", "null"]},
42
+ "end": {"type": ["string", "null"]}
43
+ }
44
+ }
45
+ },
46
+ "required": ["total_lines", "parsed_events", "errors", "warnings"]
47
+ }
48
+ },
49
+ "required": ["events", "errors", "warnings", "statistics"]
50
+ }
51
+
52
+ anomaly_schema = {
53
+ "type": "object",
54
+ "properties": {
55
+ "anomalies": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "object",
59
+ "properties": {
60
+ "type": {"type": "string"},
61
+ "severity": {"type": "string"},
62
+ "description": {"type": "string"},
63
+ "count": {"type": ["integer", "null"]},
64
+ "error_message": {"type": ["string", "null"]},
65
+ "metadata": {"type": ["object", "null"]}
66
+ },
67
+ "required": ["type", "severity", "description"]
68
+ }
69
+ },
70
+ "statistics": {
71
+ "type": "object",
72
+ "properties": {
73
+ "total": {"type": "integer"},
74
+ "by_type": {"type": "object"},
75
+ "by_severity": {"type": "object"}
76
+ }
77
+ },
78
+ "severity_summary": {"type": "object"}
79
+ },
80
+ "required": ["anomalies", "statistics", "severity_summary"]
81
+ }
82
+
83
+ rca_schema = {
84
+ "type": "object",
85
+ "properties": {
86
+ "analysis": {
87
+ "type": "object",
88
+ "properties": {
89
+ "root_causes": {
90
+ "type": "array",
91
+ "items": {"type": "string"}
92
+ },
93
+ "details": {
94
+ "type": "array",
95
+ "items": {
96
+ "type": "object",
97
+ "properties": {
98
+ "anomaly_type": {"type": "string"},
99
+ "severity": {"type": "string"},
100
+ "description": {"type": "string"},
101
+ "possible_causes": {
102
+ "type": "array",
103
+ "items": {"type": "string"}
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ },
110
+ "recommendations": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "object",
114
+ "properties": {
115
+ "priority": {"type": "string"},
116
+ "text": {"type": "string"},
117
+ "actions": {
118
+ "type": "array",
119
+ "items": {"type": "string"}
120
+ }
121
+ },
122
+ "required": ["priority", "text"]
123
+ }
124
+ },
125
+ "general_recommendations": {
126
+ "type": "array",
127
+ "items": {"type": "string"}
128
+ }
129
+ },
130
+ "required": ["analysis", "recommendations", "general_recommendations"]
131
+ }
test_logs/123.log CHANGED
@@ -1,357 +1,357 @@
1
- ===== Application Startup at 2026-01-09 15:15:33 =====
2
-
3
- Running on local URL: http://0.0.0.0:7860
4
- /usr/local/lib/python3.10/site-packages/gradio/analytics.py:106: UserWarning: IMPORTANT: You are using gradio version 4.44.0, however version 4.44.1 is available, please upgrade.
5
- --------
6
- warnings.warn(
7
- ERROR: Exception in ASGI application
8
- Traceback (most recent call last):
9
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
10
- result = await app( # type: ignore[func-returns-value]
11
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
12
- return await self.app(scope, receive, send)
13
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
14
- await super().__call__(scope, receive, send)
15
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
16
- await self.middleware_stack(scope, receive, send)
17
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
18
- raise exc
19
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
20
- await self.app(scope, receive, _send)
21
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
22
- await self.app(scope, receive, send)
23
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
24
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
25
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
26
- raise exc
27
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
28
- await app(scope, receive, sender)
29
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
30
- await self.app(scope, receive, send)
31
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
32
- await self.middleware_stack(scope, receive, send)
33
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
34
- await route.handle(scope, receive, send)
35
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
36
- await self.app(scope, receive, send)
37
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
38
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
39
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
40
- raise exc
41
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
42
- await app(scope, receive, sender)
43
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
44
- response = await f(request)
45
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
46
- raw_response = await run_endpoint_function(
47
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
48
- return await run_in_threadpool(dependant.call, **values)
49
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
50
- return await anyio.to_thread.run_sync(func)
51
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
52
- return await get_async_backend().run_sync_in_worker_thread(
53
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
54
- return await future
55
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
56
- result = context.run(func, *args)
57
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
58
- gradio_api_info = api_info(False)
59
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
60
- app.api_info = app.get_blocks().get_api_info()
61
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
62
- python_type = client_utils.json_schema_to_python_type(info)
63
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
64
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
65
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
66
- des = [
67
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
68
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
69
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
70
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
71
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
72
- type_ = get_type(schema)
73
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
74
- if "const" in schema:
75
- TypeError: argument of type 'bool' is not iterable
76
- ERROR: Exception in ASGI application
77
- Traceback (most recent call last):
78
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
79
- result = await app( # type: ignore[func-returns-value]
80
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
81
- return await self.app(scope, receive, send)
82
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
83
- await super().__call__(scope, receive, send)
84
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
85
- await self.middleware_stack(scope, receive, send)
86
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
87
- raise exc
88
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
89
- await self.app(scope, receive, _send)
90
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
91
- await self.app(scope, receive, send)
92
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
93
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
94
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
95
- raise exc
96
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
97
- await app(scope, receive, sender)
98
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
99
- await self.app(scope, receive, send)
100
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
101
- await self.middleware_stack(scope, receive, send)
102
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
103
- await route.handle(scope, receive, send)
104
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
105
- await self.app(scope, receive, send)
106
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
107
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
108
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
109
- raise exc
110
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
111
- await app(scope, receive, sender)
112
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
113
- response = await f(request)
114
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
115
- raw_response = await run_endpoint_function(
116
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
117
- return await run_in_threadpool(dependant.call, **values)
118
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
119
- return await anyio.to_thread.run_sync(func)
120
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
121
- return await get_async_backend().run_sync_in_worker_thread(
122
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
123
- return await future
124
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
125
- result = context.run(func, *args)
126
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
127
- gradio_api_info = api_info(False)
128
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
129
- app.api_info = app.get_blocks().get_api_info()
130
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
131
- python_type = client_utils.json_schema_to_python_type(info)
132
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
133
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
134
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
135
- des = [
136
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
137
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
138
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
139
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
140
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
141
- type_ = get_type(schema)
142
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
143
- if "const" in schema:
144
- TypeError: argument of type 'bool' is not iterable
145
- ERROR: Exception in ASGI application
146
- Traceback (most recent call last):
147
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
148
- result = await app( # type: ignore[func-returns-value]
149
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
150
- return await self.app(scope, receive, send)
151
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
152
- await super().__call__(scope, receive, send)
153
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
154
- await self.middleware_stack(scope, receive, send)
155
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
156
- raise exc
157
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
158
- await self.app(scope, receive, _send)
159
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
160
- await self.app(scope, receive, send)
161
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
162
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
163
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
164
- raise exc
165
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
166
- await app(scope, receive, sender)
167
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
168
- await self.app(scope, receive, send)
169
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
170
- await self.middleware_stack(scope, receive, send)
171
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
172
- await route.handle(scope, receive, send)
173
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
174
- await self.app(scope, receive, send)
175
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
176
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
177
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
178
- raise exc
179
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
180
- await app(scope, receive, sender)
181
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
182
- response = await f(request)
183
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
184
- raw_response = await run_endpoint_function(
185
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
186
- return await run_in_threadpool(dependant.call, **values)
187
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
188
- return await anyio.to_thread.run_sync(func)
189
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
190
- return await get_async_backend().run_sync_in_worker_thread(
191
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
192
- return await future
193
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
194
- result = context.run(func, *args)
195
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
196
- gradio_api_info = api_info(False)
197
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
198
- app.api_info = app.get_blocks().get_api_info()
199
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
200
- python_type = client_utils.json_schema_to_python_type(info)
201
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
202
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
203
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
204
- des = [
205
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
206
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
207
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
208
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
209
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
210
- type_ = get_type(schema)
211
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
212
- if "const" in schema:
213
- TypeError: argument of type 'bool' is not iterable
214
- ERROR: Exception in ASGI application
215
- Traceback (most recent call last):
216
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
217
- result = await app( # type: ignore[func-returns-value]
218
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
219
- return await self.app(scope, receive, send)
220
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
221
- await super().__call__(scope, receive, send)
222
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
223
- await self.middleware_stack(scope, receive, send)
224
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
225
- raise exc
226
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
227
- await self.app(scope, receive, _send)
228
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
229
- await self.app(scope, receive, send)
230
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
231
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
232
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
233
- raise exc
234
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
235
- await app(scope, receive, sender)
236
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
237
- await self.app(scope, receive, send)
238
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
239
- await self.middleware_stack(scope, receive, send)
240
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
241
- await route.handle(scope, receive, send)
242
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
243
- await self.app(scope, receive, send)
244
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
245
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
246
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
247
- raise exc
248
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
249
- await app(scope, receive, sender)
250
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
251
- response = await f(request)
252
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
253
- raw_response = await run_endpoint_function(
254
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
255
- return await run_in_threadpool(dependant.call, **values)
256
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
257
- return await anyio.to_thread.run_sync(func)
258
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
259
- return await get_async_backend().run_sync_in_worker_thread(
260
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
261
- return await future
262
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
263
- result = context.run(func, *args)
264
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
265
- gradio_api_info = api_info(False)
266
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
267
- app.api_info = app.get_blocks().get_api_info()
268
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
269
- python_type = client_utils.json_schema_to_python_type(info)
270
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
271
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
272
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
273
- des = [
274
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
275
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
276
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
277
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
278
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
279
- type_ = get_type(schema)
280
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
281
- if "const" in schema:
282
- TypeError: argument of type 'bool' is not iterable
283
- ERROR: Exception in ASGI application
284
- Traceback (most recent call last):
285
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
286
- result = await app( # type: ignore[func-returns-value]
287
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
288
- return await self.app(scope, receive, send)
289
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
290
- await super().__call__(scope, receive, send)
291
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
292
- await self.middleware_stack(scope, receive, send)
293
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
294
- raise exc
295
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
296
- await self.app(scope, receive, _send)
297
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
298
- await self.app(scope, receive, send)
299
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
300
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
301
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
302
- raise exc
303
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
304
- await app(scope, receive, sender)
305
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
306
- await self.app(scope, receive, send)
307
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
308
- await self.middleware_stack(scope, receive, send)
309
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
310
- await route.handle(scope, receive, send)
311
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
312
- await self.app(scope, receive, send)
313
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
314
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
315
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
316
- raise exc
317
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
318
- await app(scope, receive, sender)
319
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
320
- response = await f(request)
321
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
322
- raw_response = await run_endpoint_function(
323
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
324
- return await run_in_threadpool(dependant.call, **values)
325
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
326
- return await anyio.to_thread.run_sync(func)
327
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
328
- return await get_async_backend().run_sync_in_worker_thread(
329
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
330
- return await future
331
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
332
- result = context.run(func, *args)
333
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
334
- gradio_api_info = api_info(False)
335
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
336
- app.api_info = app.get_blocks().get_api_info()
337
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
338
- python_type = client_utils.json_schema_to_python_type(info)
339
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
340
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
341
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
342
- des = [
343
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
344
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
345
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
346
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
347
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
348
- type_ = get_type(schema)
349
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
350
- if "const" in schema:
351
- TypeError: argument of type 'bool' is not iterable
352
- Traceback (most recent call last):
353
- File "/app/app.py", line 215, in <module>
354
- app.launch(server_name="0.0.0.0", server_port=7860)
355
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2466, in launch
356
- raise ValueError(
357
  ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.
 
1
+ ===== Application Startup at 2026-01-09 15:15:33 =====
2
+
3
+ Running on local URL: http://0.0.0.0:7860
4
+ /usr/local/lib/python3.10/site-packages/gradio/analytics.py:106: UserWarning: IMPORTANT: You are using gradio version 4.44.0, however version 4.44.1 is available, please upgrade.
5
+ --------
6
+ warnings.warn(
7
+ ERROR: Exception in ASGI application
8
+ Traceback (most recent call last):
9
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
10
+ result = await app( # type: ignore[func-returns-value]
11
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
12
+ return await self.app(scope, receive, send)
13
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
14
+ await super().__call__(scope, receive, send)
15
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
16
+ await self.middleware_stack(scope, receive, send)
17
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
18
+ raise exc
19
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
20
+ await self.app(scope, receive, _send)
21
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
22
+ await self.app(scope, receive, send)
23
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
24
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
25
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
26
+ raise exc
27
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
28
+ await app(scope, receive, sender)
29
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
30
+ await self.app(scope, receive, send)
31
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
32
+ await self.middleware_stack(scope, receive, send)
33
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
34
+ await route.handle(scope, receive, send)
35
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
36
+ await self.app(scope, receive, send)
37
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
38
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
39
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
40
+ raise exc
41
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
42
+ await app(scope, receive, sender)
43
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
44
+ response = await f(request)
45
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
46
+ raw_response = await run_endpoint_function(
47
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
48
+ return await run_in_threadpool(dependant.call, **values)
49
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
50
+ return await anyio.to_thread.run_sync(func)
51
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
52
+ return await get_async_backend().run_sync_in_worker_thread(
53
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
54
+ return await future
55
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
56
+ result = context.run(func, *args)
57
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
58
+ gradio_api_info = api_info(False)
59
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
60
+ app.api_info = app.get_blocks().get_api_info()
61
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
62
+ python_type = client_utils.json_schema_to_python_type(info)
63
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
64
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
65
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
66
+ des = [
67
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
68
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
69
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
70
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
71
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
72
+ type_ = get_type(schema)
73
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
74
+ if "const" in schema:
75
+ TypeError: argument of type 'bool' is not iterable
76
+ ERROR: Exception in ASGI application
77
+ Traceback (most recent call last):
78
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
79
+ result = await app( # type: ignore[func-returns-value]
80
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
81
+ return await self.app(scope, receive, send)
82
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
83
+ await super().__call__(scope, receive, send)
84
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
85
+ await self.middleware_stack(scope, receive, send)
86
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
87
+ raise exc
88
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
89
+ await self.app(scope, receive, _send)
90
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
91
+ await self.app(scope, receive, send)
92
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
93
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
94
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
95
+ raise exc
96
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
97
+ await app(scope, receive, sender)
98
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
99
+ await self.app(scope, receive, send)
100
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
101
+ await self.middleware_stack(scope, receive, send)
102
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
103
+ await route.handle(scope, receive, send)
104
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
105
+ await self.app(scope, receive, send)
106
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
107
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
108
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
109
+ raise exc
110
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
111
+ await app(scope, receive, sender)
112
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
113
+ response = await f(request)
114
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
115
+ raw_response = await run_endpoint_function(
116
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
117
+ return await run_in_threadpool(dependant.call, **values)
118
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
119
+ return await anyio.to_thread.run_sync(func)
120
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
121
+ return await get_async_backend().run_sync_in_worker_thread(
122
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
123
+ return await future
124
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
125
+ result = context.run(func, *args)
126
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
127
+ gradio_api_info = api_info(False)
128
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
129
+ app.api_info = app.get_blocks().get_api_info()
130
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
131
+ python_type = client_utils.json_schema_to_python_type(info)
132
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
133
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
134
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
135
+ des = [
136
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
137
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
138
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
139
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
140
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
141
+ type_ = get_type(schema)
142
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
143
+ if "const" in schema:
144
+ TypeError: argument of type 'bool' is not iterable
145
+ ERROR: Exception in ASGI application
146
+ Traceback (most recent call last):
147
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
148
+ result = await app( # type: ignore[func-returns-value]
149
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
150
+ return await self.app(scope, receive, send)
151
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
152
+ await super().__call__(scope, receive, send)
153
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
154
+ await self.middleware_stack(scope, receive, send)
155
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
156
+ raise exc
157
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
158
+ await self.app(scope, receive, _send)
159
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
160
+ await self.app(scope, receive, send)
161
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
162
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
163
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
164
+ raise exc
165
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
166
+ await app(scope, receive, sender)
167
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
168
+ await self.app(scope, receive, send)
169
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
170
+ await self.middleware_stack(scope, receive, send)
171
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
172
+ await route.handle(scope, receive, send)
173
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
174
+ await self.app(scope, receive, send)
175
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
176
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
177
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
178
+ raise exc
179
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
180
+ await app(scope, receive, sender)
181
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
182
+ response = await f(request)
183
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
184
+ raw_response = await run_endpoint_function(
185
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
186
+ return await run_in_threadpool(dependant.call, **values)
187
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
188
+ return await anyio.to_thread.run_sync(func)
189
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
190
+ return await get_async_backend().run_sync_in_worker_thread(
191
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
192
+ return await future
193
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
194
+ result = context.run(func, *args)
195
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
196
+ gradio_api_info = api_info(False)
197
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
198
+ app.api_info = app.get_blocks().get_api_info()
199
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
200
+ python_type = client_utils.json_schema_to_python_type(info)
201
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
202
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
203
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
204
+ des = [
205
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
206
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
207
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
208
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
209
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
210
+ type_ = get_type(schema)
211
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
212
+ if "const" in schema:
213
+ TypeError: argument of type 'bool' is not iterable
214
+ ERROR: Exception in ASGI application
215
+ Traceback (most recent call last):
216
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
217
+ result = await app( # type: ignore[func-returns-value]
218
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
219
+ return await self.app(scope, receive, send)
220
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
221
+ await super().__call__(scope, receive, send)
222
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
223
+ await self.middleware_stack(scope, receive, send)
224
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
225
+ raise exc
226
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
227
+ await self.app(scope, receive, _send)
228
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
229
+ await self.app(scope, receive, send)
230
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
231
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
232
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
233
+ raise exc
234
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
235
+ await app(scope, receive, sender)
236
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
237
+ await self.app(scope, receive, send)
238
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
239
+ await self.middleware_stack(scope, receive, send)
240
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
241
+ await route.handle(scope, receive, send)
242
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
243
+ await self.app(scope, receive, send)
244
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
245
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
246
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
247
+ raise exc
248
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
249
+ await app(scope, receive, sender)
250
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
251
+ response = await f(request)
252
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
253
+ raw_response = await run_endpoint_function(
254
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
255
+ return await run_in_threadpool(dependant.call, **values)
256
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
257
+ return await anyio.to_thread.run_sync(func)
258
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
259
+ return await get_async_backend().run_sync_in_worker_thread(
260
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
261
+ return await future
262
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
263
+ result = context.run(func, *args)
264
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
265
+ gradio_api_info = api_info(False)
266
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
267
+ app.api_info = app.get_blocks().get_api_info()
268
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
269
+ python_type = client_utils.json_schema_to_python_type(info)
270
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
271
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
272
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
273
+ des = [
274
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
275
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
276
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
277
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
278
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
279
+ type_ = get_type(schema)
280
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
281
+ if "const" in schema:
282
+ TypeError: argument of type 'bool' is not iterable
283
+ ERROR: Exception in ASGI application
284
+ Traceback (most recent call last):
285
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
286
+ result = await app( # type: ignore[func-returns-value]
287
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
288
+ return await self.app(scope, receive, send)
289
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
290
+ await super().__call__(scope, receive, send)
291
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
292
+ await self.middleware_stack(scope, receive, send)
293
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
294
+ raise exc
295
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
296
+ await self.app(scope, receive, _send)
297
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 761, in __call__
298
+ await self.app(scope, receive, send)
299
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
300
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
301
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
302
+ raise exc
303
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
304
+ await app(scope, receive, sender)
305
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
306
+ await self.app(scope, receive, send)
307
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
308
+ await self.middleware_stack(scope, receive, send)
309
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
310
+ await route.handle(scope, receive, send)
311
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
312
+ await self.app(scope, receive, send)
313
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
314
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
315
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
316
+ raise exc
317
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
318
+ await app(scope, receive, sender)
319
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
320
+ response = await f(request)
321
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
322
+ raw_response = await run_endpoint_function(
323
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
324
+ return await run_in_threadpool(dependant.call, **values)
325
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
326
+ return await anyio.to_thread.run_sync(func)
327
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
328
+ return await get_async_backend().run_sync_in_worker_thread(
329
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
330
+ return await future
331
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
332
+ result = context.run(func, *args)
333
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 431, in main
334
+ gradio_api_info = api_info(False)
335
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 460, in api_info
336
+ app.api_info = app.get_blocks().get_api_info()
337
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2786, in get_api_info
338
+ python_type = client_utils.json_schema_to_python_type(info)
339
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 893, in json_schema_to_python_type
340
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
341
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 947, in _json_schema_to_python_type
342
+ des = [
343
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 948, in <listcomp>
344
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
345
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 955, in _json_schema_to_python_type
346
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
347
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 901, in _json_schema_to_python_type
348
+ type_ = get_type(schema)
349
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 863, in get_type
350
+ if "const" in schema:
351
+ TypeError: argument of type 'bool' is not iterable
352
+ Traceback (most recent call last):
353
+ File "/app/app.py", line 215, in <module>
354
+ app.launch(server_name="0.0.0.0", server_port=7860)
355
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2466, in launch
356
+ raise ValueError(
357
  ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.
test_logs/2.log CHANGED
@@ -1,491 +1,491 @@
1
- ===== Application Startup at 2026-01-09 15:48:54 =====
2
-
3
- * Running on local URL: http://0.0.0.0:7860, with SSR ⚡ (experimental, to disable set `ssr=False` in `launch()`)
4
- ERROR: Exception in ASGI application
5
- Traceback (most recent call last):
6
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
7
- result = await app( # type: ignore[func-returns-value]
8
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
9
- return await self.app(scope, receive, send)
10
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
11
- await super().__call__(scope, receive, send)
12
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
13
- await self.middleware_stack(scope, receive, send)
14
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
15
- raise exc
16
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
17
- await self.app(scope, receive, _send)
18
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
19
- with recv_stream, send_stream, collapse_excgroups():
20
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
21
- self.gen.throw(typ, value, traceback)
22
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
23
- raise exc
24
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
25
- response = await self.dispatch_func(request, call_next)
26
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
27
- response = await call_next(request)
28
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
29
- raise app_exc from app_exc.__cause__ or app_exc.__context__
30
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
31
- await self.app(scope, receive_or_disconnect, send_no_error)
32
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
33
- await self.app(scope, receive, send)
34
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
35
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
36
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
37
- raise exc
38
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
39
- await app(scope, receive, sender)
40
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
41
- await self.app(scope, receive, send)
42
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
43
- await self.middleware_stack(scope, receive, send)
44
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
45
- await route.handle(scope, receive, send)
46
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
47
- await self.app(scope, receive, send)
48
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
49
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
50
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
51
- raise exc
52
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
53
- await app(scope, receive, sender)
54
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
55
- response = await f(request)
56
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
57
- raw_response = await run_endpoint_function(
58
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
59
- return await run_in_threadpool(dependant.call, **values)
60
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
61
- return await anyio.to_thread.run_sync(func)
62
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
63
- return await get_async_backend().run_sync_in_worker_thread(
64
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
65
- return await future
66
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
67
- result = context.run(func, *args)
68
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
69
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
70
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
71
- python_type = client_utils.json_schema_to_python_type(info)
72
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
73
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
74
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
75
- des = [
76
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
77
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
78
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
79
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
80
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
81
- type_ = get_type(schema)
82
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
83
- if "const" in schema:
84
- TypeError: argument of type 'bool' is not iterable
85
- ERROR: Exception in ASGI application
86
- Traceback (most recent call last):
87
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
88
- result = await app( # type: ignore[func-returns-value]
89
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
90
- return await self.app(scope, receive, send)
91
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
92
- await super().__call__(scope, receive, send)
93
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
94
- await self.middleware_stack(scope, receive, send)
95
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
96
- raise exc
97
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
98
- await self.app(scope, receive, _send)
99
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
100
- with recv_stream, send_stream, collapse_excgroups():
101
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
102
- self.gen.throw(typ, value, traceback)
103
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
104
- raise exc
105
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
106
- response = await self.dispatch_func(request, call_next)
107
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
108
- response = await call_next(request)
109
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
110
- raise app_exc from app_exc.__cause__ or app_exc.__context__
111
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
112
- await self.app(scope, receive_or_disconnect, send_no_error)
113
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
114
- await self.app(scope, receive, send)
115
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
116
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
117
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
118
- raise exc
119
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
120
- await app(scope, receive, sender)
121
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
122
- await self.app(scope, receive, send)
123
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
124
- await self.middleware_stack(scope, receive, send)
125
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
126
- await route.handle(scope, receive, send)
127
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
128
- await self.app(scope, receive, send)
129
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
130
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
131
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
132
- raise exc
133
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
134
- await app(scope, receive, sender)
135
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
136
- response = await f(request)
137
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
138
- raw_response = await run_endpoint_function(
139
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
140
- return await run_in_threadpool(dependant.call, **values)
141
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
142
- return await anyio.to_thread.run_sync(func)
143
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
144
- return await get_async_backend().run_sync_in_worker_thread(
145
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
146
- return await future
147
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
148
- result = context.run(func, *args)
149
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
150
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
151
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
152
- python_type = client_utils.json_schema_to_python_type(info)
153
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
154
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
155
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
156
- des = [
157
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
158
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
159
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
160
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
161
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
162
- type_ = get_type(schema)
163
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
164
- if "const" in schema:
165
- TypeError: argument of type 'bool' is not iterable
166
-
167
- To create a public link, set `share=True` in `launch()`.
168
- ERROR: Exception in ASGI application
169
- Traceback (most recent call last):
170
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
171
- result = await app( # type: ignore[func-returns-value]
172
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
173
- return await self.app(scope, receive, send)
174
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
175
- await super().__call__(scope, receive, send)
176
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
177
- await self.middleware_stack(scope, receive, send)
178
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
179
- raise exc
180
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
181
- await self.app(scope, receive, _send)
182
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
183
- with recv_stream, send_stream, collapse_excgroups():
184
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
185
- self.gen.throw(typ, value, traceback)
186
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
187
- raise exc
188
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
189
- response = await self.dispatch_func(request, call_next)
190
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
191
- response = await call_next(request)
192
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
193
- raise app_exc from app_exc.__cause__ or app_exc.__context__
194
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
195
- await self.app(scope, receive_or_disconnect, send_no_error)
196
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
197
- await self.app(scope, receive, send)
198
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
199
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
200
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
201
- raise exc
202
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
203
- await app(scope, receive, sender)
204
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
205
- await self.app(scope, receive, send)
206
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
207
- await self.middleware_stack(scope, receive, send)
208
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
209
- await route.handle(scope, receive, send)
210
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
211
- await self.app(scope, receive, send)
212
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
213
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
214
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
215
- raise exc
216
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
217
- await app(scope, receive, sender)
218
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
219
- response = await f(request)
220
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
221
- raw_response = await run_endpoint_function(
222
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
223
- return await run_in_threadpool(dependant.call, **values)
224
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
225
- return await anyio.to_thread.run_sync(func)
226
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
227
- return await get_async_backend().run_sync_in_worker_thread(
228
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
229
- return await future
230
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
231
- result = context.run(func, *args)
232
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
233
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
234
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
235
- python_type = client_utils.json_schema_to_python_type(info)
236
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
237
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
238
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
239
- des = [
240
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
241
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
242
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
243
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
244
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
245
- type_ = get_type(schema)
246
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
247
- if "const" in schema:
248
- TypeError: argument of type 'bool' is not iterable
249
- ERROR: Exception in ASGI application
250
- Traceback (most recent call last):
251
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
252
- result = await app( # type: ignore[func-returns-value]
253
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
254
- return await self.app(scope, receive, send)
255
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
256
- await super().__call__(scope, receive, send)
257
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
258
- await self.middleware_stack(scope, receive, send)
259
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
260
- raise exc
261
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
262
- await self.app(scope, receive, _send)
263
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
264
- with recv_stream, send_stream, collapse_excgroups():
265
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
266
- self.gen.throw(typ, value, traceback)
267
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
268
- raise exc
269
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
270
- response = await self.dispatch_func(request, call_next)
271
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
272
- response = await call_next(request)
273
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
274
- raise app_exc from app_exc.__cause__ or app_exc.__context__
275
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
276
- await self.app(scope, receive_or_disconnect, send_no_error)
277
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
278
- await self.app(scope, receive, send)
279
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
280
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
281
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
282
- raise exc
283
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
284
- await app(scope, receive, sender)
285
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
286
- await self.app(scope, receive, send)
287
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
288
- await self.middleware_stack(scope, receive, send)
289
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
290
- await route.handle(scope, receive, send)
291
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
292
- await self.app(scope, receive, send)
293
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
294
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
295
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
296
- raise exc
297
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
298
- await app(scope, receive, sender)
299
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
300
- response = await f(request)
301
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
302
- raw_response = await run_endpoint_function(
303
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
304
- return await run_in_threadpool(dependant.call, **values)
305
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
306
- return await anyio.to_thread.run_sync(func)
307
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
308
- return await get_async_backend().run_sync_in_worker_thread(
309
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
310
- return await future
311
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
312
- result = context.run(func, *args)
313
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
314
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
315
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
316
- python_type = client_utils.json_schema_to_python_type(info)
317
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
318
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
319
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
320
- des = [
321
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
322
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
323
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
324
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
325
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
326
- type_ = get_type(schema)
327
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
328
- if "const" in schema:
329
- TypeError: argument of type 'bool' is not iterable
330
- ERROR: Exception in ASGI application
331
- Traceback (most recent call last):
332
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
333
- result = await app( # type: ignore[func-returns-value]
334
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
335
- return await self.app(scope, receive, send)
336
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
337
- await super().__call__(scope, receive, send)
338
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
339
- await self.middleware_stack(scope, receive, send)
340
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
341
- raise exc
342
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
343
- await self.app(scope, receive, _send)
344
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
345
- with recv_stream, send_stream, collapse_excgroups():
346
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
347
- self.gen.throw(typ, value, traceback)
348
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
349
- raise exc
350
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
351
- response = await self.dispatch_func(request, call_next)
352
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
353
- response = await call_next(request)
354
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
355
- raise app_exc from app_exc.__cause__ or app_exc.__context__
356
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
357
- await self.app(scope, receive_or_disconnect, send_no_error)
358
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
359
- await self.app(scope, receive, send)
360
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
361
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
362
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
363
- raise exc
364
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
365
- await app(scope, receive, sender)
366
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
367
- await self.app(scope, receive, send)
368
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
369
- await self.middleware_stack(scope, receive, send)
370
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
371
- await route.handle(scope, receive, send)
372
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
373
- await self.app(scope, receive, send)
374
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
375
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
376
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
377
- raise exc
378
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
379
- await app(scope, receive, sender)
380
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
381
- response = await f(request)
382
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
383
- raw_response = await run_endpoint_function(
384
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
385
- return await run_in_threadpool(dependant.call, **values)
386
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
387
- return await anyio.to_thread.run_sync(func)
388
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
389
- return await get_async_backend().run_sync_in_worker_thread(
390
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
391
- return await future
392
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
393
- result = context.run(func, *args)
394
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
395
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
396
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
397
- python_type = client_utils.json_schema_to_python_type(info)
398
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
399
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
400
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
401
- des = [
402
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
403
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
404
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
405
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
406
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
407
- type_ = get_type(schema)
408
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
409
- if "const" in schema:
410
- TypeError: argument of type 'bool' is not iterable
411
- ERROR: Exception in ASGI application
412
- Traceback (most recent call last):
413
- File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
414
- result = await app( # type: ignore[func-returns-value]
415
- File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
416
- return await self.app(scope, receive, send)
417
- File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
418
- await super().__call__(scope, receive, send)
419
- File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
420
- await self.middleware_stack(scope, receive, send)
421
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
422
- raise exc
423
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
424
- await self.app(scope, receive, _send)
425
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
426
- with recv_stream, send_stream, collapse_excgroups():
427
- File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
428
- self.gen.throw(typ, value, traceback)
429
- File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
430
- raise exc
431
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
432
- response = await self.dispatch_func(request, call_next)
433
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
434
- response = await call_next(request)
435
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
436
- raise app_exc from app_exc.__cause__ or app_exc.__context__
437
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
438
- await self.app(scope, receive_or_disconnect, send_no_error)
439
- File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
440
- await self.app(scope, receive, send)
441
- File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
442
- await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
443
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
444
- raise exc
445
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
446
- await app(scope, receive, sender)
447
- File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
448
- await self.app(scope, receive, send)
449
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
450
- await self.middleware_stack(scope, receive, send)
451
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
452
- await route.handle(scope, receive, send)
453
- File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
454
- await self.app(scope, receive, send)
455
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
456
- await wrap_app_handling_exceptions(app, request)(scope, receive, send)
457
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
458
- raise exc
459
- File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
460
- await app(scope, receive, sender)
461
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
462
- response = await f(request)
463
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
464
- raw_response = await run_endpoint_function(
465
- File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
466
- return await run_in_threadpool(dependant.call, **values)
467
- File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
468
- return await anyio.to_thread.run_sync(func)
469
- File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
470
- return await get_async_backend().run_sync_in_worker_thread(
471
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
472
- return await future
473
- File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
474
- result = context.run(func, *args)
475
- File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
476
- api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
477
- File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
478
- python_type = client_utils.json_schema_to_python_type(info)
479
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
480
- type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
481
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
482
- des = [
483
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
484
- f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
485
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
486
- f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
487
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
488
- type_ = get_type(schema)
489
- File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
490
- if "const" in schema:
491
  TypeError: argument of type 'bool' is not iterable
 
1
+ ===== Application Startup at 2026-01-09 15:48:54 =====
2
+
3
+ * Running on local URL: http://0.0.0.0:7860, with SSR ⚡ (experimental, to disable set `ssr=False` in `launch()`)
4
+ ERROR: Exception in ASGI application
5
+ Traceback (most recent call last):
6
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
7
+ result = await app( # type: ignore[func-returns-value]
8
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
9
+ return await self.app(scope, receive, send)
10
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
11
+ await super().__call__(scope, receive, send)
12
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
13
+ await self.middleware_stack(scope, receive, send)
14
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
15
+ raise exc
16
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
17
+ await self.app(scope, receive, _send)
18
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
19
+ with recv_stream, send_stream, collapse_excgroups():
20
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
21
+ self.gen.throw(typ, value, traceback)
22
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
23
+ raise exc
24
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
25
+ response = await self.dispatch_func(request, call_next)
26
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
27
+ response = await call_next(request)
28
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
29
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
30
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
31
+ await self.app(scope, receive_or_disconnect, send_no_error)
32
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
33
+ await self.app(scope, receive, send)
34
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
35
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
36
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
37
+ raise exc
38
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
39
+ await app(scope, receive, sender)
40
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
41
+ await self.app(scope, receive, send)
42
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
43
+ await self.middleware_stack(scope, receive, send)
44
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
45
+ await route.handle(scope, receive, send)
46
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
47
+ await self.app(scope, receive, send)
48
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
49
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
50
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
51
+ raise exc
52
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
53
+ await app(scope, receive, sender)
54
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
55
+ response = await f(request)
56
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
57
+ raw_response = await run_endpoint_function(
58
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
59
+ return await run_in_threadpool(dependant.call, **values)
60
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
61
+ return await anyio.to_thread.run_sync(func)
62
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
63
+ return await get_async_backend().run_sync_in_worker_thread(
64
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
65
+ return await future
66
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
67
+ result = context.run(func, *args)
68
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
69
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
70
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
71
+ python_type = client_utils.json_schema_to_python_type(info)
72
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
73
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
74
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
75
+ des = [
76
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
77
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
78
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
79
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
80
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
81
+ type_ = get_type(schema)
82
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
83
+ if "const" in schema:
84
+ TypeError: argument of type 'bool' is not iterable
85
+ ERROR: Exception in ASGI application
86
+ Traceback (most recent call last):
87
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
88
+ result = await app( # type: ignore[func-returns-value]
89
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
90
+ return await self.app(scope, receive, send)
91
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
92
+ await super().__call__(scope, receive, send)
93
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
94
+ await self.middleware_stack(scope, receive, send)
95
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
96
+ raise exc
97
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
98
+ await self.app(scope, receive, _send)
99
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
100
+ with recv_stream, send_stream, collapse_excgroups():
101
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
102
+ self.gen.throw(typ, value, traceback)
103
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
104
+ raise exc
105
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
106
+ response = await self.dispatch_func(request, call_next)
107
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
108
+ response = await call_next(request)
109
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
110
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
111
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
112
+ await self.app(scope, receive_or_disconnect, send_no_error)
113
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
114
+ await self.app(scope, receive, send)
115
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
116
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
117
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
118
+ raise exc
119
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
120
+ await app(scope, receive, sender)
121
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
122
+ await self.app(scope, receive, send)
123
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
124
+ await self.middleware_stack(scope, receive, send)
125
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
126
+ await route.handle(scope, receive, send)
127
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
128
+ await self.app(scope, receive, send)
129
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
130
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
131
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
132
+ raise exc
133
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
134
+ await app(scope, receive, sender)
135
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
136
+ response = await f(request)
137
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
138
+ raw_response = await run_endpoint_function(
139
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
140
+ return await run_in_threadpool(dependant.call, **values)
141
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
142
+ return await anyio.to_thread.run_sync(func)
143
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
144
+ return await get_async_backend().run_sync_in_worker_thread(
145
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
146
+ return await future
147
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
148
+ result = context.run(func, *args)
149
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
150
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
151
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
152
+ python_type = client_utils.json_schema_to_python_type(info)
153
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
154
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
155
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
156
+ des = [
157
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
158
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
159
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
160
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
161
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
162
+ type_ = get_type(schema)
163
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
164
+ if "const" in schema:
165
+ TypeError: argument of type 'bool' is not iterable
166
+
167
+ To create a public link, set `share=True` in `launch()`.
168
+ ERROR: Exception in ASGI application
169
+ Traceback (most recent call last):
170
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
171
+ result = await app( # type: ignore[func-returns-value]
172
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
173
+ return await self.app(scope, receive, send)
174
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
175
+ await super().__call__(scope, receive, send)
176
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
177
+ await self.middleware_stack(scope, receive, send)
178
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
179
+ raise exc
180
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
181
+ await self.app(scope, receive, _send)
182
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
183
+ with recv_stream, send_stream, collapse_excgroups():
184
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
185
+ self.gen.throw(typ, value, traceback)
186
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
187
+ raise exc
188
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
189
+ response = await self.dispatch_func(request, call_next)
190
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
191
+ response = await call_next(request)
192
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
193
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
194
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
195
+ await self.app(scope, receive_or_disconnect, send_no_error)
196
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
197
+ await self.app(scope, receive, send)
198
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
199
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
200
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
201
+ raise exc
202
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
203
+ await app(scope, receive, sender)
204
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
205
+ await self.app(scope, receive, send)
206
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
207
+ await self.middleware_stack(scope, receive, send)
208
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
209
+ await route.handle(scope, receive, send)
210
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
211
+ await self.app(scope, receive, send)
212
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
213
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
214
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
215
+ raise exc
216
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
217
+ await app(scope, receive, sender)
218
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
219
+ response = await f(request)
220
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
221
+ raw_response = await run_endpoint_function(
222
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
223
+ return await run_in_threadpool(dependant.call, **values)
224
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
225
+ return await anyio.to_thread.run_sync(func)
226
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
227
+ return await get_async_backend().run_sync_in_worker_thread(
228
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
229
+ return await future
230
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
231
+ result = context.run(func, *args)
232
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
233
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
234
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
235
+ python_type = client_utils.json_schema_to_python_type(info)
236
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
237
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
238
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
239
+ des = [
240
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
241
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
242
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
243
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
244
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
245
+ type_ = get_type(schema)
246
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
247
+ if "const" in schema:
248
+ TypeError: argument of type 'bool' is not iterable
249
+ ERROR: Exception in ASGI application
250
+ Traceback (most recent call last):
251
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
252
+ result = await app( # type: ignore[func-returns-value]
253
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
254
+ return await self.app(scope, receive, send)
255
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
256
+ await super().__call__(scope, receive, send)
257
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
258
+ await self.middleware_stack(scope, receive, send)
259
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
260
+ raise exc
261
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
262
+ await self.app(scope, receive, _send)
263
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
264
+ with recv_stream, send_stream, collapse_excgroups():
265
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
266
+ self.gen.throw(typ, value, traceback)
267
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
268
+ raise exc
269
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
270
+ response = await self.dispatch_func(request, call_next)
271
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
272
+ response = await call_next(request)
273
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
274
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
275
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
276
+ await self.app(scope, receive_or_disconnect, send_no_error)
277
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
278
+ await self.app(scope, receive, send)
279
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
280
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
281
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
282
+ raise exc
283
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
284
+ await app(scope, receive, sender)
285
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
286
+ await self.app(scope, receive, send)
287
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
288
+ await self.middleware_stack(scope, receive, send)
289
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
290
+ await route.handle(scope, receive, send)
291
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
292
+ await self.app(scope, receive, send)
293
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
294
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
295
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
296
+ raise exc
297
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
298
+ await app(scope, receive, sender)
299
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
300
+ response = await f(request)
301
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
302
+ raw_response = await run_endpoint_function(
303
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
304
+ return await run_in_threadpool(dependant.call, **values)
305
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
306
+ return await anyio.to_thread.run_sync(func)
307
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
308
+ return await get_async_backend().run_sync_in_worker_thread(
309
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
310
+ return await future
311
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
312
+ result = context.run(func, *args)
313
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
314
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
315
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
316
+ python_type = client_utils.json_schema_to_python_type(info)
317
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
318
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
319
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
320
+ des = [
321
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
322
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
323
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
324
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
325
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
326
+ type_ = get_type(schema)
327
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
328
+ if "const" in schema:
329
+ TypeError: argument of type 'bool' is not iterable
330
+ ERROR: Exception in ASGI application
331
+ Traceback (most recent call last):
332
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
333
+ result = await app( # type: ignore[func-returns-value]
334
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
335
+ return await self.app(scope, receive, send)
336
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
337
+ await super().__call__(scope, receive, send)
338
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
339
+ await self.middleware_stack(scope, receive, send)
340
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
341
+ raise exc
342
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
343
+ await self.app(scope, receive, _send)
344
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
345
+ with recv_stream, send_stream, collapse_excgroups():
346
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
347
+ self.gen.throw(typ, value, traceback)
348
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
349
+ raise exc
350
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
351
+ response = await self.dispatch_func(request, call_next)
352
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
353
+ response = await call_next(request)
354
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
355
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
356
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
357
+ await self.app(scope, receive_or_disconnect, send_no_error)
358
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
359
+ await self.app(scope, receive, send)
360
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
361
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
362
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
363
+ raise exc
364
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
365
+ await app(scope, receive, sender)
366
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
367
+ await self.app(scope, receive, send)
368
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
369
+ await self.middleware_stack(scope, receive, send)
370
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
371
+ await route.handle(scope, receive, send)
372
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
373
+ await self.app(scope, receive, send)
374
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
375
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
376
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
377
+ raise exc
378
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
379
+ await app(scope, receive, sender)
380
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
381
+ response = await f(request)
382
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
383
+ raw_response = await run_endpoint_function(
384
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
385
+ return await run_in_threadpool(dependant.call, **values)
386
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
387
+ return await anyio.to_thread.run_sync(func)
388
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
389
+ return await get_async_backend().run_sync_in_worker_thread(
390
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
391
+ return await future
392
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
393
+ result = context.run(func, *args)
394
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
395
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
396
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
397
+ python_type = client_utils.json_schema_to_python_type(info)
398
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
399
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
400
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
401
+ des = [
402
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
403
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
404
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
405
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
406
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
407
+ type_ = get_type(schema)
408
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
409
+ if "const" in schema:
410
+ TypeError: argument of type 'bool' is not iterable
411
+ ERROR: Exception in ASGI application
412
+ Traceback (most recent call last):
413
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 410, in run_asgi
414
+ result = await app( # type: ignore[func-returns-value]
415
+ File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
416
+ return await self.app(scope, receive, send)
417
+ File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1135, in __call__
418
+ await super().__call__(scope, receive, send)
419
+ File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
420
+ await self.middleware_stack(scope, receive, send)
421
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__
422
+ raise exc
423
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
424
+ await self.app(scope, receive, _send)
425
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 191, in __call__
426
+ with recv_stream, send_stream, collapse_excgroups():
427
+ File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
428
+ self.gen.throw(typ, value, traceback)
429
+ File "/usr/local/lib/python3.10/site-packages/starlette/_utils.py", line 85, in collapse_excgroups
430
+ raise exc
431
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 193, in __call__
432
+ response = await self.dispatch_func(request, call_next)
433
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 392, in conditional_routing_middleware
434
+ response = await call_next(request)
435
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 168, in call_next
436
+ raise app_exc from app_exc.__cause__ or app_exc.__context__
437
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/base.py", line 144, in coro
438
+ await self.app(scope, receive_or_disconnect, send_no_error)
439
+ File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 789, in __call__
440
+ await self.app(scope, receive, send)
441
+ File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
442
+ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
443
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
444
+ raise exc
445
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
446
+ await app(scope, receive, sender)
447
+ File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
448
+ await self.app(scope, receive, send)
449
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
450
+ await self.middleware_stack(scope, receive, send)
451
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
452
+ await route.handle(scope, receive, send)
453
+ File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
454
+ await self.app(scope, receive, send)
455
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 115, in app
456
+ await wrap_app_handling_exceptions(app, request)(scope, receive, send)
457
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
458
+ raise exc
459
+ File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
460
+ await app(scope, receive, sender)
461
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 101, in app
462
+ response = await f(request)
463
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 355, in app
464
+ raw_response = await run_endpoint_function(
465
+ File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 245, in run_endpoint_function
466
+ return await run_in_threadpool(dependant.call, **values)
467
+ File "/usr/local/lib/python3.10/site-packages/starlette/concurrency.py", line 32, in run_in_threadpool
468
+ return await anyio.to_thread.run_sync(func)
469
+ File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 63, in run_sync
470
+ return await get_async_backend().run_sync_in_worker_thread(
471
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2502, in run_sync_in_worker_thread
472
+ return await future
473
+ File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 986, in run
474
+ result = context.run(func, *args)
475
+ File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 583, in api_info
476
+ api_info = utils.safe_deepcopy(app.get_blocks().get_api_info())
477
+ File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2927, in get_api_info
478
+ python_type = client_utils.json_schema_to_python_type(info)
479
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 920, in json_schema_to_python_type
480
+ type_ = _json_schema_to_python_type(schema, schema.get("$defs"))
481
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 974, in _json_schema_to_python_type
482
+ des = [
483
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 975, in <listcomp>
484
+ f"{n}: {_json_schema_to_python_type(v, defs)}{get_desc(v)}"
485
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 982, in _json_schema_to_python_type
486
+ f"str, {_json_schema_to_python_type(schema['additionalProperties'], defs)}"
487
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 928, in _json_schema_to_python_type
488
+ type_ = get_type(schema)
489
+ File "/usr/local/lib/python3.10/site-packages/gradio_client/utils.py", line 887, in get_type
490
+ if "const" in schema:
491
  TypeError: argument of type 'bool' is not iterable
utils/__init__.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # utils/__init__.py
2
+ from .validation import validate_schema
3
+ from .agent_runner import run_agent_safely
4
+
5
+ __all__ = ['validate_schema', 'run_agent_safely']
utils/agent_runner.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # utils/agent_runner.py
2
+ import json
3
+
4
+ def run_agent_safely(agent, max_retries=3, **kwargs):
5
+ """
6
+ Безопасно запускает агента с повторными попытками при ошибках.
7
+
8
+ Args:
9
+ agent: Экземпляр агента smolagents
10
+ max_retries: Максимальное количество попыток
11
+ **kwargs: Аргументы для передачи агенту
12
+
13
+ Returns:
14
+ dict: Распарсенный JSON ответ от агента
15
+ """
16
+ last_error = None
17
+
18
+ for attempt in range(1, max_retries + 1):
19
+ try:
20
+ result = agent.run(**kwargs)
21
+
22
+ # Извлекаем ответ из результата
23
+ if isinstance(result, dict) and "answer" in result:
24
+ raw = result["answer"]
25
+ else:
26
+ raw = result
27
+
28
+ if not isinstance(raw, str):
29
+ raise ValueError("Agent output is not a string")
30
+
31
+ # Парсим JSON
32
+ return json.loads(raw)
33
+
34
+ except Exception as e:
35
+ last_error = e
36
+ print(f"[{agent.name}] ❌ Attempt {attempt}/{max_retries} failed: {e}")
37
+
38
+ raise ValueError(
39
+ f"[{agent.name}] Failed after {max_retries} attempts.\nLast error: {last_error}"
40
+ )
utils/validation.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # utils/validation.py
2
+ from jsonschema import validate, ValidationError
3
+
4
+ def validate_schema(data: dict, schema: dict):
5
+ """Валидирует данные по схеме JSON Schema."""
6
+ try:
7
+ validate(instance=data, schema=schema)
8
+ except ValidationError as e:
9
+ raise ValueError(f"Ошибка валидации JSON: {e.message}")