Spaces:
Build error
Build error
checkin_app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
@st.cache_resource
|
| 5 |
+
def load_model():
|
| 6 |
+
return pipeline("text-classification", model="Terrence/checkin-classifier")
|
| 7 |
+
|
| 8 |
+
classifier = load_model()
|
| 9 |
+
|
| 10 |
+
st.title("Check-In Classifier")
|
| 11 |
+
st.write("Classify your check-in as Good, Average, Bad, Repetitive, or Great.")
|
| 12 |
+
|
| 13 |
+
user_input = st.text_area("Enter your check-in:")
|
| 14 |
+
|
| 15 |
+
if st.button("Classify"):
|
| 16 |
+
if user_input.strip():
|
| 17 |
+
result = classifier(user_input)
|
| 18 |
+
label = result[0]['label']
|
| 19 |
+
score = result[0]['score']
|
| 20 |
+
st.success(f"**Prediction:** {label} ({score:.2%} confidence)")
|
| 21 |
+
else:
|
| 22 |
+
st.warning("Please enter a check-in.")
|