Spaces:
Sleeping
Sleeping
Changing to fitness message classifier
Browse files
app.py
CHANGED
@@ -1,10 +1,17 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
-
import torch
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
6 |
text = st.text_area("Enter text: ")
|
|
|
7 |
if text:
|
|
|
8 |
out = pipe(text)
|
9 |
-
st.json(out)
|
10 |
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
+
# Load pre-trained model pipeline
|
5 |
+
model_name = "lucieackley/autotrain-fitness_message_classification-40235104670"
|
6 |
+
pipe = pipeline('text-classification', model=model_name)
|
7 |
+
|
8 |
+
st.title("Fitness Message Classifier")
|
9 |
+
|
10 |
text = st.text_area("Enter text: ")
|
11 |
+
|
12 |
if text:
|
13 |
+
# Get model's prediction
|
14 |
out = pipe(text)
|
|
|
15 |
|
16 |
+
# Show prediction
|
17 |
+
st.write(f"The text was classified as: {out[0]['label']} with a score of {out[0]['score']:.2f}")
|