Spaces:
Runtime error
Runtime error
[email protected]
commited on
Commit
·
47f3322
1
Parent(s):
ea16d8c
sentiments
Browse files
language_models_project/app.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
#from main import classify
|
| 2 |
-
#import easyocr as ocr #OCR
|
| 3 |
import streamlit as st #Web App
|
| 4 |
from main import classify
|
| 5 |
|
|
@@ -16,8 +14,12 @@ input_sentences = st.text_area("Sentences", value="", height=200)
|
|
| 16 |
|
| 17 |
data = input_sentences.split('\n')
|
| 18 |
|
|
|
|
| 19 |
for i in data:
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
st.markdown("Link to the app - [image-to-text-app on 🤗 Spaces](https://huggingface.co/spaces/Amrrs/image-to-text-app)")
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st #Web App
|
| 2 |
from main import classify
|
| 3 |
|
|
|
|
| 14 |
|
| 15 |
data = input_sentences.split('\n')
|
| 16 |
|
| 17 |
+
#if st.button("Classify"):
|
| 18 |
for i in data:
|
| 19 |
+
j = classify(i)[0]
|
| 20 |
+
sentiment = j['label'] == 'POS'
|
| 21 |
+
confidence = j['score']
|
| 22 |
+
st.write(f"{i} :: Classification - {'positive' if sentiment else 'negative'} with confidence {confidence}")
|
| 23 |
|
| 24 |
|
| 25 |
st.markdown("Link to the app - [image-to-text-app on 🤗 Spaces](https://huggingface.co/spaces/Amrrs/image-to-text-app)")
|