Spaces:
Sleeping
Sleeping
add file_processing_time
Browse files
app.py
CHANGED
|
@@ -405,6 +405,7 @@ class ChatBot:
|
|
| 405 |
return "Please upload a CSV file first."
|
| 406 |
|
| 407 |
try:
|
|
|
|
| 408 |
print(f"Processing file using model: {self.model_key}")
|
| 409 |
# Handle file from Gradio
|
| 410 |
file_path = file.name if hasattr(file, 'name') else str(file)
|
|
@@ -466,10 +467,11 @@ class ChatBot:
|
|
| 466 |
return f"Error creating chain: {str(e)}"
|
| 467 |
|
| 468 |
# Add basic file info to chat history for context
|
|
|
|
| 469 |
file_info = f"CSV successfully loaded with {df.shape[0]} rows and {len(df.columns)} columns using model {self.model_key}. Columns: {', '.join(df.columns.tolist())}"
|
| 470 |
self.chat_history.append(("System", file_info))
|
| 471 |
|
| 472 |
-
return f"CSV file successfully processed with model {self.model_key}! You can now chat with the model to analyze the data
|
| 473 |
except Exception as e:
|
| 474 |
import traceback
|
| 475 |
print(traceback.format_exc())
|
|
|
|
| 405 |
return "Please upload a CSV file first."
|
| 406 |
|
| 407 |
try:
|
| 408 |
+
start_time = time.time()
|
| 409 |
print(f"Processing file using model: {self.model_key}")
|
| 410 |
# Handle file from Gradio
|
| 411 |
file_path = file.name if hasattr(file, 'name') else str(file)
|
|
|
|
| 467 |
return f"Error creating chain: {str(e)}"
|
| 468 |
|
| 469 |
# Add basic file info to chat history for context
|
| 470 |
+
file_processing_time = time.time() - start_time
|
| 471 |
file_info = f"CSV successfully loaded with {df.shape[0]} rows and {len(df.columns)} columns using model {self.model_key}. Columns: {', '.join(df.columns.tolist())}"
|
| 472 |
self.chat_history.append(("System", file_info))
|
| 473 |
|
| 474 |
+
return f"CSV file successfully processed with model {self.model_key}! You can now chat with the model to analyze the data.\n\n[Processing time: {file_processing_time:.2f} seconds]"
|
| 475 |
except Exception as e:
|
| 476 |
import traceback
|
| 477 |
print(traceback.format_exc())
|