Merge branch 'main' into milestone-3
Browse files- .github/workflows/main.yml +1 -1
- app.py +24 -18
- working_training.ipynb +0 -0
.github/workflows/main.yml
CHANGED
@@ -23,4 +23,4 @@ jobs:
|
|
23 |
&& git switch main
|
24 |
&& git merge origin/milestone-3
|
25 |
&& git push
|
26 |
-
&& git push https://jbraha:$HF_TOKEN@huggingface.co/spaces/jbraha/aiproject
|
|
|
23 |
&& git switch main
|
24 |
&& git merge origin/milestone-3
|
25 |
&& git push
|
26 |
+
&& git push -f https://jbraha:$HF_TOKEN@huggingface.co/spaces/jbraha/aiproject
|
app.py
CHANGED
@@ -43,16 +43,17 @@ option = st.selectbox(
|
|
43 |
('Default', 'Fine-Tuned' , 'Roberta'))
|
44 |
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
56 |
|
57 |
|
58 |
|
@@ -74,13 +75,18 @@ strings = [ "D'aww! He matches this background colour I'm seemingly stuck with.
|
|
74 |
|
75 |
|
76 |
if st.button('Analyze'):
|
77 |
-
result = classifier(input)
|
78 |
-
result = result[0]
|
79 |
if option == 'Fine-Tuned':
|
|
|
|
|
80 |
result = unpack(result)
|
81 |
add_to_table(input, result, output)
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
st.write(result)
|
85 |
else:
|
86 |
st.write('Excited to analyze!')
|
@@ -88,10 +94,10 @@ else:
|
|
88 |
|
89 |
|
90 |
for string in strings:
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
add_to_table(string,
|
95 |
|
96 |
st.table(output)
|
97 |
|
|
|
43 |
('Default', 'Fine-Tuned' , 'Roberta'))
|
44 |
|
45 |
|
46 |
+
# init classifiers
|
47 |
+
|
48 |
+
model = AutoModelForSequenceClassification.from_pretrained(fine_tuned)
|
49 |
+
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
|
50 |
+
ft_classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer, top_k=None)
|
51 |
+
|
52 |
+
model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
|
54 |
+
rob_classifier = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
|
55 |
+
|
56 |
+
def_classifier = pipeline('sentiment-analysis')
|
57 |
|
58 |
|
59 |
|
|
|
75 |
|
76 |
|
77 |
if st.button('Analyze'):
|
|
|
|
|
78 |
if option == 'Fine-Tuned':
|
79 |
+
result = ft_classifier(input)
|
80 |
+
result = result[0]
|
81 |
result = unpack(result)
|
82 |
add_to_table(input, result, output)
|
83 |
+
elif option == 'Roberta':
|
84 |
+
result = rob_classifier(input)
|
85 |
+
result = result[0]
|
86 |
+
st.write(result)
|
87 |
+
elif option == 'Default':
|
88 |
+
result = def_classifier(input)
|
89 |
+
result = result[0]
|
90 |
st.write(result)
|
91 |
else:
|
92 |
st.write('Excited to analyze!')
|
|
|
94 |
|
95 |
|
96 |
for string in strings:
|
97 |
+
item = ft_classifier(string)
|
98 |
+
item = item[0]
|
99 |
+
item = unpack(item)
|
100 |
+
add_to_table(string, item, output)
|
101 |
|
102 |
st.table(output)
|
103 |
|
working_training.ipynb
CHANGED
The diff for this file is too large to render.
See raw diff
|
|