Spaces:
Running
Running
support multiple output formats
Browse files
app.py
CHANGED
|
@@ -73,11 +73,12 @@ def query_sql(user_query: str) -> str:
|
|
| 73 |
# Log the SQL query result
|
| 74 |
print(f"SQL Query Result: {result}")
|
| 75 |
|
|
|
|
| 76 |
try:
|
| 77 |
float_result = float(result)
|
| 78 |
-
return f"{float_result:.2f}"
|
| 79 |
except ValueError:
|
| 80 |
-
return result
|
| 81 |
|
| 82 |
def handle_query(user_input: str) -> str:
|
| 83 |
"""
|
|
|
|
| 73 |
# Log the SQL query result
|
| 74 |
print(f"SQL Query Result: {result}")
|
| 75 |
|
| 76 |
+
# Ensure proper formatting based on content
|
| 77 |
try:
|
| 78 |
float_result = float(result)
|
| 79 |
+
return f"{float_result:.2f}" # Format numbers to 2 decimal places
|
| 80 |
except ValueError:
|
| 81 |
+
return result # Return text results directly without modification
|
| 82 |
|
| 83 |
def handle_query(user_input: str) -> str:
|
| 84 |
"""
|