Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -266,6 +266,26 @@ def display_table(analyst_output):
|
|
266 |
table_data = data.to_dict(orient="records")
|
267 |
return table_data
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
# Main Execution Block
|
270 |
if st.button("Generate Patent Insights"):
|
271 |
with st.spinner('Processing...'):
|
|
|
266 |
table_data = data.to_dict(orient="records")
|
267 |
return table_data
|
268 |
|
269 |
+
def parse_analyst_output(raw_output):
|
270 |
+
structured_data = []
|
271 |
+
current_category = None
|
272 |
+
|
273 |
+
lines = raw_output.split('\n')
|
274 |
+
|
275 |
+
for line in lines:
|
276 |
+
line = line.strip()
|
277 |
+
if line.startswith("Category:"):
|
278 |
+
current_category = line.replace("Category:", "").strip()
|
279 |
+
elif line.startswith("Values:"):
|
280 |
+
continue # Skip the "Values:" line
|
281 |
+
elif line and current_category:
|
282 |
+
structured_data.append({
|
283 |
+
"Category": current_category,
|
284 |
+
"Values": line
|
285 |
+
})
|
286 |
+
return structured_data
|
287 |
+
|
288 |
+
|
289 |
# Main Execution Block
|
290 |
if st.button("Generate Patent Insights"):
|
291 |
with st.spinner('Processing...'):
|