Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -132,24 +132,13 @@ if uploaded_files and api_key:
|
|
132 |
try:
|
133 |
# Analyze PDF directly
|
134 |
# Convert PDF to images
|
135 |
-
images = pdf_to_images(uploaded_file.getvalue())
|
136 |
|
137 |
-
|
138 |
-
raw_response = analyze_single_document(images, PROMPT)
|
139 |
-
|
140 |
-
# raw_response = analyze_pdf_directly(
|
141 |
-
# pdf_bytes=uploaded_file.getvalue(),
|
142 |
-
# prompt=PROMPT,
|
143 |
-
# model_name="gemini-1.5-pro" # or "gemini-1.5-flash"
|
144 |
-
# )
|
145 |
-
|
146 |
-
# Process response
|
147 |
-
csv_data = extract_csv_from_response(raw_response)
|
148 |
|
149 |
# Display results in expandable section
|
150 |
with st.expander("View Analysis Results", expanded=True):
|
151 |
if csv_data:
|
152 |
-
|
153 |
print(f"DataFrame: {df}")
|
154 |
if not df.empty:
|
155 |
st.dataframe(df)
|
|
|
132 |
try:
|
133 |
# Analyze PDF directly
|
134 |
# Convert PDF to images
|
|
|
135 |
|
136 |
+
df = process_local_pdf(uploaded_file.getvalue())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
# Display results in expandable section
|
139 |
with st.expander("View Analysis Results", expanded=True):
|
140 |
if csv_data:
|
141 |
+
|
142 |
print(f"DataFrame: {df}")
|
143 |
if not df.empty:
|
144 |
st.dataframe(df)
|