Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import plotly.express as px
|
|
8 |
import time
|
9 |
|
10 |
# Title and Sidebar
|
11 |
-
st.title("Patent Insights Consultant")
|
12 |
|
13 |
st.sidebar.write(
|
14 |
"This Patent Insights Consultant uses a multi-agent system to provide actionable insights and data analysis for the patent domain."
|
@@ -18,6 +18,13 @@ st.sidebar.write(
|
|
18 |
patent_area = st.text_input('Enter Patent Technology Area', value="Artificial Intelligence")
|
19 |
stakeholder = st.text_input('Enter Stakeholder', value="Patent Attorneys")
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
# Optional Customization
|
22 |
st.sidebar.subheader("Agent Customization")
|
23 |
|
@@ -151,6 +158,18 @@ def generate_pdf_report(result):
|
|
151 |
pdf.output(report_path)
|
152 |
return report_path
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
if st.button("Generate Patent Insights"):
|
155 |
with st.spinner('Processing...'):
|
156 |
try:
|
@@ -182,6 +201,10 @@ if st.button("Generate Patent Insights"):
|
|
182 |
analyst_output = getattr(results.tasks_output[1], "raw", "No details available.")
|
183 |
st.write(analyst_output)
|
184 |
|
|
|
|
|
|
|
|
|
185 |
# Display Token Usage and Execution Time
|
186 |
st.success(f"Analysis completed in {elapsed_time:.2f} seconds.")
|
187 |
token_usage = getattr(results, "token_usage", None)
|
|
|
8 |
import time
|
9 |
|
10 |
# Title and Sidebar
|
11 |
+
st.title("🤖 Patent Insights Consultant")
|
12 |
|
13 |
st.sidebar.write(
|
14 |
"This Patent Insights Consultant uses a multi-agent system to provide actionable insights and data analysis for the patent domain."
|
|
|
18 |
patent_area = st.text_input('Enter Patent Technology Area', value="Artificial Intelligence")
|
19 |
stakeholder = st.text_input('Enter Stakeholder', value="Patent Attorneys")
|
20 |
|
21 |
+
# Advanced Options
|
22 |
+
st.sidebar.subheader("Advanced Options")
|
23 |
+
|
24 |
+
# Enable/Disable Advanced Features
|
25 |
+
enable_advanced_analysis = st.sidebar.checkbox("Enable Advanced Analysis", value=True)
|
26 |
+
enable_custom_visualization = st.sidebar.checkbox("Enable Custom Visualizations", value=True)
|
27 |
+
|
28 |
# Optional Customization
|
29 |
st.sidebar.subheader("Agent Customization")
|
30 |
|
|
|
158 |
pdf.output(report_path)
|
159 |
return report_path
|
160 |
|
161 |
+
def create_visualizations(analyst_output):
|
162 |
+
"""Create visualizations for advanced insights."""
|
163 |
+
if enable_custom_visualization and analyst_output:
|
164 |
+
try:
|
165 |
+
data = pd.DataFrame(analyst_output)
|
166 |
+
st.markdown("### Advanced Visualization")
|
167 |
+
|
168 |
+
fig = px.bar(data, x="Category", y="Values", title="Patent Trends by Category")
|
169 |
+
st.plotly_chart(fig)
|
170 |
+
except Exception as e:
|
171 |
+
st.warning(f"Failed to create visualizations: {e}")
|
172 |
+
|
173 |
if st.button("Generate Patent Insights"):
|
174 |
with st.spinner('Processing...'):
|
175 |
try:
|
|
|
201 |
analyst_output = getattr(results.tasks_output[1], "raw", "No details available.")
|
202 |
st.write(analyst_output)
|
203 |
|
204 |
+
# Generate visualizations if enabled
|
205 |
+
if enable_advanced_analysis:
|
206 |
+
create_visualizations(analyst_output)
|
207 |
+
|
208 |
# Display Token Usage and Execution Time
|
209 |
st.success(f"Analysis completed in {elapsed_time:.2f} seconds.")
|
210 |
token_usage = getattr(results, "token_usage", None)
|