Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
4 |
|
5 |
-
|
6 |
-
tokenizer = AutoTokenizer.from_pretrained("Donlapark/finetuned_yelp")
|
7 |
-
model = AutoModelForSequenceClassification.from_pretrained("Donlapark/finetuned_yelp")
|
8 |
def main():
|
9 |
st.title("Yelp review")
|
10 |
|
@@ -13,9 +10,8 @@ def main():
|
|
13 |
# clicked==True only when the button is clicked
|
14 |
clicked = st.form_submit_button("Submit")
|
15 |
if clicked:
|
16 |
-
|
17 |
-
|
18 |
-
st.write(f"Predicted review: {results.argmax()}, Score: {results.max()}")
|
19 |
|
20 |
if __name__ == "__main__":
|
21 |
main()
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
|
|
3 |
|
4 |
+
classifier = pipeline("sentiment-analysis", model="Donlapark/finetuned_yelp")
|
|
|
|
|
5 |
def main():
|
6 |
st.title("Yelp review")
|
7 |
|
|
|
10 |
# clicked==True only when the button is clicked
|
11 |
clicked = st.form_submit_button("Submit")
|
12 |
if clicked:
|
13 |
+
results = classifier([text])
|
14 |
+
st.json(results)
|
|
|
15 |
|
16 |
if __name__ == "__main__":
|
17 |
main()
|