File size: 839 Bytes
ef91953
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from yolo_text_extraction import extract_text_from_sections, cv_to_json
import json

def main():
    st.title("CV to JSON Converter")

    uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")

    if uploaded_file is not None:
        if st.button("Convert to JSON"):
            try:
                result = cv_to_json(uploaded_file)
                st.json(result)
                
                # Option to download the JSON
                st.download_button(
                    label="Download JSON",
                    data=json.dumps(result, indent=2),
                    file_name="cv_data.json",
                    mime="application/json"
                )
            except Exception as e:
                st.error(f"An error occurred: {str(e)}")

if __name__ == "__main__":
    main()