cv-to-json / app.py
Essa20001's picture
Upload app.py with huggingface_hub
ef91953 verified
raw
history blame
839 Bytes
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()