Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,37 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import tempfile
|
| 3 |
import os
|
| 4 |
from cv_analyzer import analyze_cv
|
| 5 |
from cv_quality import CV
|
|
|
|
| 6 |
|
| 7 |
st.set_page_config(page_title="CV Analyzer", layout="wide")
|
| 8 |
st.title('CV Analyzer')
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
uploaded_file = st.file_uploader("Choose a CV file", type=['pdf', 'docx', 'txt'])
|
| 11 |
|
| 12 |
if uploaded_file is not None:
|
| 13 |
-
with st.spinner('
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
# Create CV object with the
|
| 20 |
-
cv = CV(
|
| 21 |
result = cv.analyse_cv_quality()
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
|
| 26 |
if "error" in result:
|
| 27 |
st.error(result["error"])
|
| 28 |
else:
|
|
|
|
| 29 |
# Personal Information
|
| 30 |
st.header("Personal Information")
|
| 31 |
personal_info = result["personal_info"]
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import os
|
| 3 |
from cv_analyzer import analyze_cv
|
| 4 |
from cv_quality import CV
|
| 5 |
+
from get_supabase import Supabase
|
| 6 |
|
| 7 |
st.set_page_config(page_title="CV Analyzer", layout="wide")
|
| 8 |
st.title('CV Analyzer')
|
| 9 |
|
| 10 |
+
# Initialize Supabase client
|
| 11 |
+
supabase_client = Supabase().init_supabase_client()
|
| 12 |
+
|
| 13 |
uploaded_file = st.file_uploader("Choose a CV file", type=['pdf', 'docx', 'txt'])
|
| 14 |
|
| 15 |
if uploaded_file is not None:
|
| 16 |
+
with st.spinner('Uploading and analyzing CV...'):
|
| 17 |
+
# Upload file to Supabase storage
|
| 18 |
+
file_path = f"cvs/{uploaded_file.name}"
|
| 19 |
+
supabase_client.storage.from_("cvs").upload(file_path, uploaded_file.getvalue())
|
| 20 |
+
|
| 21 |
+
# Get the public URL of the uploaded file
|
| 22 |
+
file_url = supabase_client.storage.from_("cvs").get_public_url(file_path)
|
| 23 |
|
| 24 |
+
# Create CV object with the file URL
|
| 25 |
+
cv = CV(file_url)
|
| 26 |
result = cv.analyse_cv_quality()
|
| 27 |
|
| 28 |
+
# Optionally, delete the file after analysis
|
| 29 |
+
# supabase_client.storage.from_("cvs").remove([file_path])
|
| 30 |
|
| 31 |
if "error" in result:
|
| 32 |
st.error(result["error"])
|
| 33 |
else:
|
| 34 |
+
# Display results (same as before)
|
| 35 |
# Personal Information
|
| 36 |
st.header("Personal Information")
|
| 37 |
personal_info = result["personal_info"]
|