Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -226,7 +226,12 @@ def identify_headers_with_openrouter(pdf_path, model,LLM_prompt, pages_to_check=
|
|
| 226 |
conf = float(obj.get('confidence') or 0)
|
| 227 |
if t and page is not None:
|
| 228 |
out.append({'text': t, 'page': page-1, 'suggested_level': level, 'confidence': conf})
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
return out
|
| 231 |
|
| 232 |
# Wrapper function to convert JSON to a dataframe-friendly format
|
|
|
|
| 226 |
conf = float(obj.get('confidence') or 0)
|
| 227 |
if t and page is not None:
|
| 228 |
out.append({'text': t, 'page': page-1, 'suggested_level': level, 'confidence': conf})
|
| 229 |
+
df = pd.DataFrame(out)
|
| 230 |
+
|
| 231 |
+
# Save to Excel
|
| 232 |
+
df.to_excel("output.xlsx", index=False)
|
| 233 |
+
|
| 234 |
+
print("Saved JSON output to output.xlsx")
|
| 235 |
return out
|
| 236 |
|
| 237 |
# Wrapper function to convert JSON to a dataframe-friendly format
|