Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,8 @@ import streamlit as st
|
|
| 2 |
import openai
|
| 3 |
import json
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
|
| 8 |
st.title("ATS Resume Scoring App 🚀")
|
| 9 |
|
|
@@ -26,12 +26,12 @@ if st.button("Get ATS Score"):
|
|
| 26 |
{resume_text}
|
| 27 |
"""
|
| 28 |
|
| 29 |
-
response =
|
| 30 |
model="gpt-3.5-turbo",
|
| 31 |
messages=[{"role": "user", "content": prompt}]
|
| 32 |
)
|
| 33 |
|
| 34 |
-
output = response.choices[0].message
|
| 35 |
|
| 36 |
try:
|
| 37 |
result = json.loads(output)
|
|
@@ -39,4 +39,4 @@ if st.button("Get ATS Score"):
|
|
| 39 |
st.info(f"🧠 Feedback: {result['feedback']}")
|
| 40 |
except Exception as e:
|
| 41 |
st.error("Something went wrong. Try again.")
|
| 42 |
-
st.text(output)
|
|
|
|
| 2 |
import openai
|
| 3 |
import json
|
| 4 |
|
| 5 |
+
# Set your OpenAI API key here
|
| 6 |
+
openai.api_key = st.secrets["key"]
|
| 7 |
|
| 8 |
st.title("ATS Resume Scoring App 🚀")
|
| 9 |
|
|
|
|
| 26 |
{resume_text}
|
| 27 |
"""
|
| 28 |
|
| 29 |
+
response = openai.ChatCompletion.create(
|
| 30 |
model="gpt-3.5-turbo",
|
| 31 |
messages=[{"role": "user", "content": prompt}]
|
| 32 |
)
|
| 33 |
|
| 34 |
+
output = response.choices[0].message["content"]
|
| 35 |
|
| 36 |
try:
|
| 37 |
result = json.loads(output)
|
|
|
|
| 39 |
st.info(f"🧠 Feedback: {result['feedback']}")
|
| 40 |
except Exception as e:
|
| 41 |
st.error("Something went wrong. Try again.")
|
| 42 |
+
st.text(output)
|