Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ def install(package):
|
|
7 |
|
8 |
st.title("Personality Prediction App")
|
9 |
|
|
|
10 |
try:
|
11 |
from transformers import pipeline
|
12 |
except ImportError:
|
@@ -14,7 +15,14 @@ except ImportError:
|
|
14 |
install('transformers')
|
15 |
st.experimental_rerun()
|
16 |
|
17 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
@st.cache_resource
|
19 |
def load_model():
|
20 |
return pipeline("text-classification", model="KevSun/Personality_LM")
|
@@ -36,4 +44,5 @@ if st.button("Predict"):
|
|
36 |
else:
|
37 |
st.warning("Please enter some text to analyze.")
|
38 |
|
39 |
-
st.info("Note: This is a demonstration and predictions may not be entirely accurate.")
|
|
|
|
7 |
|
8 |
st.title("Personality Prediction App")
|
9 |
|
10 |
+
# Check and install transformers library
|
11 |
try:
|
12 |
from transformers import pipeline
|
13 |
except ImportError:
|
|
|
15 |
install('transformers')
|
16 |
st.experimental_rerun()
|
17 |
|
18 |
+
# Check and install numpy library
|
19 |
+
try:
|
20 |
+
import numpy as np
|
21 |
+
except ImportError:
|
22 |
+
st.warning("The numpy library is not installed. Attempting to install it now...")
|
23 |
+
install('numpy')
|
24 |
+
st.experimental_rerun()
|
25 |
+
|
26 |
@st.cache_resource
|
27 |
def load_model():
|
28 |
return pipeline("text-classification", model="KevSun/Personality_LM")
|
|
|
44 |
else:
|
45 |
st.warning("Please enter some text to analyze.")
|
46 |
|
47 |
+
st.info("Note: This is a demonstration and predictions may not be entirely accurate.")
|
48 |
+
|