Alex Martin commited on
Commit
878ee24
2 Parent(s): f2807aa b489fb7

Merge pull request #3 from alexmartian24/milestone-2

Browse files
Files changed (3) hide show
  1. README.md +11 -0
  2. app.py +26 -0
  3. requirements.txt +7 -0
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # midterm
2
  # milestone 1
3
  #sudo pacman -S docker <- to download
 
1
+ ---
2
+ title: Sentiment Analysis
3
+ emoji: 🐠
4
+ colorFrom: gray
5
+ colorTo: pink
6
+ sdk: streamlit
7
+ sdk_version: 1.17.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+ link: https://huggingface.co/spaces/aim9061/sentiment-analysis
12
  # midterm
13
  # milestone 1
14
  #sudo pacman -S docker <- to download
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
+ st.markdown("Link to the app - [milestone2-app](https://huggingface.co/spaces/aim9061/sentiment-analysis)")
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
+
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ opencv-python-headless
3
+ numpy
4
+ pandas
5
+ Pillow
6
+ transformers
7
+ torch