Spaces:
Sleeping
Sleeping
Add text classification functionality using Hugging Face model
Browse files
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
app.py
CHANGED
|
@@ -1,5 +1,15 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
st.title('My first app')
|
| 4 |
x = st.slider('Select a value')
|
| 5 |
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
st.title('My first app')
|
| 5 |
x = st.slider('Select a value')
|
| 6 |
st.write(x, 'squared is', x * x)
|
| 7 |
+
|
| 8 |
+
classifier = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english")
|
| 9 |
+
|
| 10 |
+
# Example input text
|
| 11 |
+
input_text = "I love using Hugging Face models!"
|
| 12 |
+
|
| 13 |
+
# Get the classification result
|
| 14 |
+
result = classifier(input_text)
|
| 15 |
+
print(result)
|