Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
import json
|
| 3 |
import os
|
| 4 |
from openai import OpenAI
|
| 5 |
import PyPDF2
|
| 6 |
import io
|
| 7 |
-
from openai.error import APIConnectionError, APIError, RateLimitError
|
| 8 |
|
| 9 |
# Load the evaluation criteria from the JSON file
|
| 10 |
@st.cache_data
|
|
@@ -76,17 +75,8 @@ def analyze_cv(cv_content, evaluation_criteria, api_key):
|
|
| 76 |
model="gpt-3.5-turbo",
|
| 77 |
)
|
| 78 |
return response.choices[0].message.content
|
| 79 |
-
except APIConnectionError as e:
|
| 80 |
-
st.error(f"Connection error: {str(e)}. Please check your internet connection and try again.")
|
| 81 |
-
return None
|
| 82 |
-
except APIError as e:
|
| 83 |
-
st.error(f"API error: {str(e)}. Please try again later.")
|
| 84 |
-
return None
|
| 85 |
-
except RateLimitError as e:
|
| 86 |
-
st.error(f"Rate limit exceeded: {str(e)}. Please try again later.")
|
| 87 |
-
return None
|
| 88 |
except Exception as e:
|
| 89 |
-
st.error(f"An
|
| 90 |
return None
|
| 91 |
|
| 92 |
def element_exists(subsection, element):
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
import json
|
| 3 |
import os
|
| 4 |
from openai import OpenAI
|
| 5 |
import PyPDF2
|
| 6 |
import io
|
|
|
|
| 7 |
|
| 8 |
# Load the evaluation criteria from the JSON file
|
| 9 |
@st.cache_data
|
|
|
|
| 75 |
model="gpt-3.5-turbo",
|
| 76 |
)
|
| 77 |
return response.choices[0].message.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
except Exception as e:
|
| 79 |
+
st.error(f"An error occurred: {str(e)}. Please try again.")
|
| 80 |
return None
|
| 81 |
|
| 82 |
def element_exists(subsection, element):
|