Essa20001 commited on
Commit
ef91953
1 Parent(s): e97b6fc

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from yolo_text_extraction import extract_text_from_sections, cv_to_json
3
+ import json
4
+
5
+ def main():
6
+ st.title("CV to JSON Converter")
7
+
8
+ uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
9
+
10
+ if uploaded_file is not None:
11
+ if st.button("Convert to JSON"):
12
+ try:
13
+ result = cv_to_json(uploaded_file)
14
+ st.json(result)
15
+
16
+ # Option to download the JSON
17
+ st.download_button(
18
+ label="Download JSON",
19
+ data=json.dumps(result, indent=2),
20
+ file_name="cv_data.json",
21
+ mime="application/json"
22
+ )
23
+ except Exception as e:
24
+ st.error(f"An error occurred: {str(e)}")
25
+
26
+ if __name__ == "__main__":
27
+ main()