Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,11 @@ import streamlit as st
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load your model
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
7 |
st.title("Personality Prediction App")
|
8 |
|
@@ -13,10 +17,14 @@ user_input = st.text_area("Your text here:")
|
|
13 |
if st.button("Predict"):
|
14 |
if user_input:
|
15 |
# Process the input and get predictions
|
16 |
-
|
|
|
17 |
|
18 |
# Display results
|
19 |
-
st.
|
20 |
-
|
|
|
21 |
else:
|
22 |
-
st.
|
|
|
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load your model
|
5 |
+
@st.cache_resource
|
6 |
+
def load_model():
|
7 |
+
return pipeline("text-classification", model="KevSun/Personality_LM")
|
8 |
+
|
9 |
+
model = load_model()
|
10 |
|
11 |
st.title("Personality Prediction App")
|
12 |
|
|
|
17 |
if st.button("Predict"):
|
18 |
if user_input:
|
19 |
# Process the input and get predictions
|
20 |
+
with st.spinner("Analyzing..."):
|
21 |
+
result = model(user_input)
|
22 |
|
23 |
# Display results
|
24 |
+
st.subheader("Predicted personality traits:")
|
25 |
+
for trait in result:
|
26 |
+
st.write(f"- {trait['label']}: {trait['score']:.2f}")
|
27 |
else:
|
28 |
+
st.warning("Please enter some text to analyze.")
|
29 |
+
|
30 |
+
st.info("Note: This is a demonstration and predictions may not be entirely accurate.")
|