Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
|
|
3 |
|
4 |
st.title("PDF Extraction App")
|
5 |
st.write("Upload a PDF file to extract correct answers and options using the backend service.")
|
@@ -25,6 +26,15 @@ if uploaded_file is not None:
|
|
25 |
result = response.json()
|
26 |
st.success("Extraction successful!")
|
27 |
st.json(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
else:
|
29 |
st.error(f"Error: {response.text}")
|
30 |
except Exception as e:
|
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
+
import json
|
4 |
|
5 |
st.title("PDF Extraction App")
|
6 |
st.write("Upload a PDF file to extract correct answers and options using the backend service.")
|
|
|
26 |
result = response.json()
|
27 |
st.success("Extraction successful!")
|
28 |
st.json(result)
|
29 |
+
|
30 |
+
# Create a download button for the JSON result
|
31 |
+
json_data = json.dumps(result, indent=2)
|
32 |
+
st.download_button(
|
33 |
+
label="Download JSON",
|
34 |
+
data=json_data,
|
35 |
+
file_name="extraction_result.json",
|
36 |
+
mime="application/json"
|
37 |
+
)
|
38 |
else:
|
39 |
st.error(f"Error: {response.text}")
|
40 |
except Exception as e:
|