Spaces:
Runtime error
Runtime error
| import streamlit as st #Web App | |
| from main import classify | |
| #title | |
| st.title("Easy OCR - Extract Text from Images") | |
| #subtitle | |
| st.markdown("## Optical Character Recognition - Using `easyocr`, `streamlit` - hosted on 🤗 Spaces") | |
| model_name = st.selectbox( | |
| 'Select a pre-trained model', | |
| [ | |
| 'finiteautomata/bertweet-base-sentiment-analysis', | |
| 'ahmedrachid/FinancialBERT-Sentiment-Analysis', | |
| 'finiteautomata/beto-sentiment-analysis' | |
| ], | |
| ) | |
| input_sentences = st.text_area("Sentences", value="", height=200) | |
| data = input_sentences.split('\n') | |
| if st.button("Classify"): | |
| for i in data: | |
| st.write(i) | |
| j = classify(model_name.strip(), i)[0] | |
| sentiment = j['label'] | |
| confidence = j['score'] | |
| st.write(f"{i} :: Classification - {sentiment} with confidence {confidence}") | |
| st.markdown("Link to the app - [image-to-text-app on 🤗 Spaces](https://huggingface.co/spaces/Amrrs/image-to-text-app)") | |