Spaces:
Sleeping
Sleeping
fix gradio?
Browse files- evaluation_logic.py +11 -3
evaluation_logic.py
CHANGED
|
@@ -59,14 +59,22 @@ def run_prediction(model_name, prompt_format, output_file):
|
|
| 59 |
table_params = list(db_to_tables.get(db_id, {}).values())
|
| 60 |
else:
|
| 61 |
table_params = []
|
| 62 |
-
|
| 63 |
if len(table_params) == 0:
|
| 64 |
yield f"[red] WARNING: No tables found for {db_id} [/red]"
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
text_to_sql_inputs.append(TextToSQLParams(
|
| 67 |
instruction=question,
|
| 68 |
database=db_id,
|
| 69 |
-
tables=
|
| 70 |
))
|
| 71 |
|
| 72 |
# Generate SQL
|
|
|
|
| 59 |
table_params = list(db_to_tables.get(db_id, {}).values())
|
| 60 |
else:
|
| 61 |
table_params = []
|
| 62 |
+
|
| 63 |
if len(table_params) == 0:
|
| 64 |
yield f"[red] WARNING: No tables found for {db_id} [/red]"
|
| 65 |
+
|
| 66 |
+
# Convert Table objects to dictionaries if they're already instantiated
|
| 67 |
+
processed_table_params = []
|
| 68 |
+
for table in table_params:
|
| 69 |
+
if isinstance(table, Table):
|
| 70 |
+
processed_table_params.append(table.dict())
|
| 71 |
+
else:
|
| 72 |
+
processed_table_params.append(table)
|
| 73 |
+
|
| 74 |
text_to_sql_inputs.append(TextToSQLParams(
|
| 75 |
instruction=question,
|
| 76 |
database=db_id,
|
| 77 |
+
tables=processed_table_params,
|
| 78 |
))
|
| 79 |
|
| 80 |
# Generate SQL
|