Spaces:
Runtime error
Runtime error
Updated generate analysis logic
Browse files
app.py
CHANGED
|
@@ -79,7 +79,6 @@ Based on all the above information, please provide a concise analysis:
|
|
| 79 |
|
| 80 |
Present the analysis in a clear, easy-to-understand manner. Avoid overly technical jargon where possible.
|
| 81 |
Provide ONLY the Markdown code block. Do not include any explanations, comments before or after the code block itself.
|
| 82 |
-
Do not include the ```markdown``` at the start and end of the code block.
|
| 83 |
"""
|
| 84 |
|
| 85 |
# --- Helper Functions ---
|
|
@@ -180,6 +179,12 @@ def simulate_and_analyze(user_query_str):
|
|
| 180 |
)
|
| 181 |
response_analysis = MODEL.generate_content(prompt_for_analysis)
|
| 182 |
analysis_text_str = response_analysis.text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
except Exception as e:
|
| 184 |
analysis_text_str = f"Error generating analysis with Gemini: {traceback.format_exc()}"
|
| 185 |
if exec_error_msg: # If code exec failed, make analysis reflect that primarily
|
|
|
|
| 79 |
|
| 80 |
Present the analysis in a clear, easy-to-understand manner. Avoid overly technical jargon where possible.
|
| 81 |
Provide ONLY the Markdown code block. Do not include any explanations, comments before or after the code block itself.
|
|
|
|
| 82 |
"""
|
| 83 |
|
| 84 |
# --- Helper Functions ---
|
|
|
|
| 179 |
)
|
| 180 |
response_analysis = MODEL.generate_content(prompt_for_analysis)
|
| 181 |
analysis_text_str = response_analysis.text
|
| 182 |
+
|
| 183 |
+
if analysis_text_str.startswith("```markdown"):
|
| 184 |
+
analysis_text_str = analysis_text_str[len("```markdown"):].strip()
|
| 185 |
+
if analysis_text_str.endswith("```"):
|
| 186 |
+
analysis_text_str = analysis_text_str[:-len("```")].strip()
|
| 187 |
+
|
| 188 |
except Exception as e:
|
| 189 |
analysis_text_str = f"Error generating analysis with Gemini: {traceback.format_exc()}"
|
| 190 |
if exec_error_msg: # If code exec failed, make analysis reflect that primarily
|