Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize the model
|
5 |
+
model_name = "distilbert-base-uncased-finetuned-sst-2-english" # Example model
|
6 |
+
classifier = pipeline("text-classification", model=model_name)
|
7 |
+
|
8 |
+
# Streamlit app layout
|
9 |
+
st.title("Intent Classification App")
|
10 |
+
|
11 |
+
# Text input
|
12 |
+
user_input = st.text_input("Enter your text here:")
|
13 |
+
|
14 |
+
if user_input:
|
15 |
+
# Model prediction
|
16 |
+
result = classifier(user_input)
|
17 |
+
# Display results
|
18 |
+
st.write("Intent:", result[0]['label'])
|
19 |
+
st.write("Confidence:", result[0]['score'])
|