Update app.py
Browse files
app.py
CHANGED
@@ -218,7 +218,14 @@ def download_report(chat_history):
|
|
218 |
report = generate_summary_report(chat_history)
|
219 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
220 |
filename = f"safety_analysis_report_{timestamp}.txt"
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
# Custom CSS for improved styling
|
224 |
custom_css = """
|
@@ -329,4 +336,4 @@ if __name__ == "__main__":
|
|
329 |
except Exception as e:
|
330 |
logger.error(f"Error when trying to launch the interface: {str(e)}")
|
331 |
logger.error(traceback.format_exc())
|
332 |
-
print("Failed to launch the Gradio interface. Please check the logs for more information.")
|
|
|
218 |
report = generate_summary_report(chat_history)
|
219 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
220 |
filename = f"safety_analysis_report_{timestamp}.txt"
|
221 |
+
|
222 |
+
# Create a temporary file
|
223 |
+
with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as temp_file:
|
224 |
+
temp_file.write(report)
|
225 |
+
temp_file_path = temp_file.name
|
226 |
+
|
227 |
+
return temp_file_path
|
228 |
+
|
229 |
|
230 |
# Custom CSS for improved styling
|
231 |
custom_css = """
|
|
|
336 |
except Exception as e:
|
337 |
logger.error(f"Error when trying to launch the interface: {str(e)}")
|
338 |
logger.error(traceback.format_exc())
|
339 |
+
print("Failed to launch the Gradio interface. Please check the logs for more information.")
|