Spaces:
Build error
Build error
ali
commited on
Commit
·
f3c9265
1
Parent(s):
7f37c72
add app.py and requirements
Browse files- app.py +19 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load your model (update the path to your saved model)
|
| 5 |
+
model = pipeline("text-classification", model="./mbti_model_2")
|
| 6 |
+
|
| 7 |
+
# Streamlit Interface
|
| 8 |
+
st.title("MBTI Personality Predictor")
|
| 9 |
+
st.write("Enter some text, and the model will predict your MBTI personality type.")
|
| 10 |
+
|
| 11 |
+
# Input text
|
| 12 |
+
user_input = st.text_area("Enter text here:")
|
| 13 |
+
|
| 14 |
+
if st.button("Predict"):
|
| 15 |
+
if user_input.strip():
|
| 16 |
+
prediction = model(user_input)
|
| 17 |
+
st.write(f"Predicted MBTI Type: {prediction[0]['label']}")
|
| 18 |
+
else:
|
| 19 |
+
st.write("Please enter some text.")
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
streamlit
|
| 3 |
+
gradio
|