Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import transformers
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
st.title("Text Classification using BERT")
|
6 |
+
text = st.text_input("Enter your text")
|
7 |
+
classifier = pipeline('text-classification', model='bert-base-uncased', tokenizer='bert-base-uncased')
|
8 |
+
|
9 |
+
label_map = {0: 'Negative', 1: 'Positive'}
|
10 |
+
label_id = result[0]['label']
|
11 |
+
label_name = label_map[label_id]
|
12 |
+
|
13 |
+
if st.button("Classify"):
|
14 |
+
result = classifier(text)
|
15 |
+
st.write("Classification Label:", label_name)
|