Spaces:
Runtime error
Runtime error
Alex Martin
commited on
Commit
•
62872aa
1
Parent(s):
602eb98
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
from transformers import pipeline
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
|
8 |
+
st.title("Toxic Tweets Sentiment Analysis")
|
9 |
+
|
10 |
+
|
11 |
+
words = "Take that, you funking cat-dragon! You smell really bad!"
|
12 |
+
text = st.text_area("Insert text for analysis below.", words)
|
13 |
+
|
14 |
+
model_list = ["distilbert-base-uncased-finetuned-sst-2-english", "bert-base-cased", "openai/clip-vit-base-patch32", "emilyalsentzer/Bio_ClinicalBERT",
|
15 |
+
"sentence-transformers/all-mpnet-base-v2", "facebook/bart-large-cnn", "openai/clip-vit-base-patch16", "speechbrain/spkrec-ecapa-voxceleb",
|
16 |
+
"albert-base-v2"]
|
17 |
+
model = st.selectbox("", model_list)
|
18 |
+
sub = st.write("Pick the model to use for analyzing the text!")
|
19 |
+
button = st.button("Analyze!")
|
20 |
+
pipe = pipeline("text-classification")
|
21 |
+
if(button):
|
22 |
+
pipe = pipeline("text-classification", model)
|
23 |
+
results = pipe(text)
|
24 |
+
st.write(results)
|
25 |
+
|
26 |
+
|