Spaces:
Sleeping
Sleeping
Merge pull request #1 from dbleek/milestone-2
Browse files- .flake8 +2 -0
- .github/workflows/deploy.yaml +20 -0
- README.md +18 -1
- app.py +26 -0
- requirements.txt +87 -0
.flake8
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[flake8]
|
2 |
+
max-line-length=90
|
.github/workflows/deploy.yaml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
2 |
+
on:
|
3 |
+
push:
|
4 |
+
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
+
workflow_dispatch:
|
8 |
+
|
9 |
+
jobs:
|
10 |
+
sync-to-hub:
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
steps:
|
13 |
+
- uses: actions/checkout@v3
|
14 |
+
with:
|
15 |
+
fetch-depth: 0
|
16 |
+
lfs: true
|
17 |
+
- name: Push to hub
|
18 |
+
env:
|
19 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push https://dbleek:[email protected]/spaces/dbleek/cs-gy-6613-project-final main
|
README.md
CHANGED
@@ -1,8 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# cs-gy-6613-project
|
2 |
Project for CS-GY-6613 Spring 2023
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
For milestone 1, I used the quick start instructions from VS code to connect to a remote Ubuntu container:
|
5 |
|
6 |
https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container
|
7 |
|
8 |
-
![Alt text](milestone-1.jpg "Screenshot for Milestone 1")
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: CS-GY-6613 Project Milestone 2
|
3 |
+
colorFrom: blue
|
4 |
+
colorTo: red
|
5 |
+
sdk: streamlit
|
6 |
+
app_file: app.py
|
7 |
+
pinned: false
|
8 |
+
---
|
9 |
+
|
10 |
# cs-gy-6613-project
|
11 |
Project for CS-GY-6613 Spring 2023
|
12 |
|
13 |
+
# Milestone 2
|
14 |
+
|
15 |
+
Sentiment Analysis App: https://huggingface.co/spaces/dbleek/cs-gy-6613-project
|
16 |
+
|
17 |
+
# Milestone 1
|
18 |
For milestone 1, I used the quick start instructions from VS code to connect to a remote Ubuntu container:
|
19 |
|
20 |
https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container
|
21 |
|
22 |
+
![Alt text](milestone-1.jpg "Screenshot for Milestone 1")
|
23 |
+
|
24 |
+
|
25 |
+
|
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import (AutoTokenizer, TFAutoModelForSequenceClassification,
|
3 |
+
pipeline)
|
4 |
+
|
5 |
+
st.title("CS-GY-6613 Project Milestone 2")
|
6 |
+
model_choices = (
|
7 |
+
"distilbert-base-uncased-finetuned-sst-2-english",
|
8 |
+
"j-hartmann/emotion-english-distilroberta-base",
|
9 |
+
"joeddav/distilbert-base-uncased-go-emotions-student",
|
10 |
+
)
|
11 |
+
|
12 |
+
with st.form("Input Form"):
|
13 |
+
text = st.text_area("Write your text here:", "CS-GY-6613 is a great course!")
|
14 |
+
model_name = st.selectbox("Select a model:", model_choices)
|
15 |
+
submitted = st.form_submit_button("Submit")
|
16 |
+
|
17 |
+
if submitted:
|
18 |
+
model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
20 |
+
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
21 |
+
res = classifier(text)
|
22 |
+
label = res[0]["label"].upper()
|
23 |
+
score = res[0]["score"]
|
24 |
+
st.markdown(
|
25 |
+
f"This text was classified as **{label}** with a confidence score of **{score}**."
|
26 |
+
)
|
requirements.txt
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
absl-py==1.4.0
|
2 |
+
altair==4.2.2
|
3 |
+
astunparse==1.6.3
|
4 |
+
attrs==22.2.0
|
5 |
+
blinker==1.6.1
|
6 |
+
cachetools==5.3.0
|
7 |
+
certifi==2022.12.7
|
8 |
+
charset-normalizer==3.1.0
|
9 |
+
click==8.1.3
|
10 |
+
decorator==5.1.1
|
11 |
+
entrypoints==0.4
|
12 |
+
filelock==3.10.7
|
13 |
+
flatbuffers==23.3.3
|
14 |
+
gast==0.4.0
|
15 |
+
gitdb==4.0.10
|
16 |
+
GitPython==3.1.31
|
17 |
+
google-auth==2.17.1
|
18 |
+
google-auth-oauthlib==1.0.0
|
19 |
+
google-pasta==0.2.0
|
20 |
+
grpcio==1.53.0
|
21 |
+
h5py==3.8.0
|
22 |
+
huggingface-hub==0.13.3
|
23 |
+
idna==3.4
|
24 |
+
importlib-metadata==6.2.1
|
25 |
+
inquirerpy==0.3.4
|
26 |
+
jax==0.4.8
|
27 |
+
Jinja2==3.1.2
|
28 |
+
jsonschema==4.17.3
|
29 |
+
keras==2.12.0
|
30 |
+
libclang==16.0.0
|
31 |
+
Markdown==3.4.3
|
32 |
+
markdown-it-py==2.2.0
|
33 |
+
MarkupSafe==2.1.2
|
34 |
+
mdurl==0.1.2
|
35 |
+
ml-dtypes==0.0.4
|
36 |
+
numpy==1.23.5
|
37 |
+
oauthlib==3.2.2
|
38 |
+
opt-einsum==3.3.0
|
39 |
+
packaging==23.0
|
40 |
+
pandas==1.5.3
|
41 |
+
pfzy==0.3.4
|
42 |
+
Pillow==9.5.0
|
43 |
+
prompt-toolkit==3.0.38
|
44 |
+
protobuf==3.20.3
|
45 |
+
pyarrow==11.0.0
|
46 |
+
pyasn1==0.4.8
|
47 |
+
pyasn1-modules==0.2.8
|
48 |
+
pydeck==0.8.0
|
49 |
+
Pygments==2.14.0
|
50 |
+
Pympler==1.0.1
|
51 |
+
pyrsistent==0.19.3
|
52 |
+
python-dateutil==2.8.2
|
53 |
+
pytz==2023.3
|
54 |
+
pytz-deprecation-shim==0.1.0.post0
|
55 |
+
PyYAML==6.0
|
56 |
+
regex==2023.3.23
|
57 |
+
requests==2.28.2
|
58 |
+
requests-oauthlib==1.3.1
|
59 |
+
rich==13.3.3
|
60 |
+
rsa==4.9
|
61 |
+
scipy==1.10.1
|
62 |
+
six==1.16.0
|
63 |
+
smmap==5.0.0
|
64 |
+
streamlit==1.21.0
|
65 |
+
tensorboard==2.12.1
|
66 |
+
tensorboard-data-server==0.7.0
|
67 |
+
tensorboard-plugin-wit==1.8.1
|
68 |
+
tensorflow==2.12.0
|
69 |
+
tensorflow-estimator==2.12.0
|
70 |
+
tensorflow-io-gcs-filesystem==0.32.0
|
71 |
+
termcolor==2.2.0
|
72 |
+
tokenizers==0.13.3
|
73 |
+
toml==0.10.2
|
74 |
+
toolz==0.12.0
|
75 |
+
tornado==6.2
|
76 |
+
tqdm==4.65.0
|
77 |
+
transformers==4.27.4
|
78 |
+
typing_extensions==4.5.0
|
79 |
+
tzdata==2023.3
|
80 |
+
tzlocal==4.3
|
81 |
+
urllib3==1.26.15
|
82 |
+
validators==0.20.0
|
83 |
+
watchdog==3.0.0
|
84 |
+
wcwidth==0.2.6
|
85 |
+
Werkzeug==2.2.3
|
86 |
+
wrapt==1.14.1
|
87 |
+
zipp==3.15.0
|