Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -113,7 +113,7 @@ analyse = Task(
|
|
113 |
description=(
|
114 |
"1. Perform statistical analysis of patent filing trends, innovation hot spots, and growth projections.\n"
|
115 |
"2. Identify top regions, key players, and technology combinations.\n"
|
116 |
-
"3. Generate visualizations such as heatmaps and multi-line charts for trends.\n"
|
117 |
"4. Provide structured output with fields 'Category' and 'Values' for visualization.\n"
|
118 |
"5. Collaborate with the Planner and Writer to align on data needs."
|
119 |
),
|
@@ -155,6 +155,7 @@ def generate_pdf_report(result, charts=None, table_data=None, metadata=None):
|
|
155 |
if table_data:
|
156 |
pdf.add_page()
|
157 |
pdf.set_font("Arial", size=10)
|
|
|
158 |
for row in table_data:
|
159 |
pdf.cell(200, 10, txt=str(row), ln=True)
|
160 |
|
@@ -200,6 +201,12 @@ def create_visualizations(analyst_output):
|
|
200 |
heatmap_chart.write_image(temp_chart.name)
|
201 |
chart_paths.append(temp_chart.name)
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
except Exception as e:
|
204 |
st.error(f"Error generating visualization: {e}")
|
205 |
return chart_paths
|
@@ -251,4 +258,4 @@ if st.button("Generate Patent Insights"):
|
|
251 |
st.download_button("Download Report", data=report_file, file_name="Patent_Strategy_Report.pdf")
|
252 |
|
253 |
except Exception as e:
|
254 |
-
st.error(f"An error occurred during execution: {e}")
|
|
|
113 |
description=(
|
114 |
"1. Perform statistical analysis of patent filing trends, innovation hot spots, and growth projections.\n"
|
115 |
"2. Identify top regions, key players, and technology combinations.\n"
|
116 |
+
"3. Generate visualizations such as heatmaps, bar charts, and multi-line charts for trends.\n"
|
117 |
"4. Provide structured output with fields 'Category' and 'Values' for visualization.\n"
|
118 |
"5. Collaborate with the Planner and Writer to align on data needs."
|
119 |
),
|
|
|
155 |
if table_data:
|
156 |
pdf.add_page()
|
157 |
pdf.set_font("Arial", size=10)
|
158 |
+
pdf.cell(200, 10, txt="Consolidated Table:", ln=True, align="L")
|
159 |
for row in table_data:
|
160 |
pdf.cell(200, 10, txt=str(row), ln=True)
|
161 |
|
|
|
201 |
heatmap_chart.write_image(temp_chart.name)
|
202 |
chart_paths.append(temp_chart.name)
|
203 |
|
204 |
+
multi_line_chart = px.line(data, x="Category", y="Values", title="Trends Over Time")
|
205 |
+
st.plotly_chart(multi_line_chart)
|
206 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_chart:
|
207 |
+
multi_line_chart.write_image(temp_chart.name)
|
208 |
+
chart_paths.append(temp_chart.name)
|
209 |
+
|
210 |
except Exception as e:
|
211 |
st.error(f"Error generating visualization: {e}")
|
212 |
return chart_paths
|
|
|
258 |
st.download_button("Download Report", data=report_file, file_name="Patent_Strategy_Report.pdf")
|
259 |
|
260 |
except Exception as e:
|
261 |
+
st.error(f"An error occurred during execution: {e}")
|