aj2614@nyu.edu commited on
Commit
44cb802
1 Parent(s): 0cec39d

and now the counter

Browse files
Files changed (1) hide show
  1. language_models_project/app.py +15 -9
language_models_project/app.py CHANGED
@@ -1,14 +1,20 @@
1
  import streamlit as st #Web App
2
  from main import classify
3
 
 
 
 
 
 
 
 
 
4
 
5
  #title
6
- st.title("Easy OCR - Extract Text from Images")
7
-
8
-
9
 
10
  #subtitle
11
- st.markdown("## Optical Character Recognition - Using `easyocr`, `streamlit` - hosted on 🤗 Spaces")
12
 
13
  model_name = st.selectbox(
14
  'Select a pre-trained model',
@@ -19,17 +25,17 @@ model_name = st.selectbox(
19
  ],
20
  )
21
 
22
- input_sentences = st.text_area("Sentences", value="", height=200)
23
 
24
  data = input_sentences.split('\n')
25
 
26
  if st.button("Classify"):
27
- for i in data:
28
- st.write(i)
29
- j = classify(model_name.strip(), i)[0]
30
  sentiment = j['label']
31
  confidence = j['score']
32
- st.write(f"{i} :: Classification - {sentiment} with confidence {confidence}")
33
 
34
 
35
  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
 
4
+ demo_phrases = """ Here are some examples:
5
+ this is a phrase
6
+ is it neutral
7
+ nothing else to say
8
+ man I'm so damn angry
9
+ sarcasm lol
10
+ I love this product
11
+ """
12
 
13
  #title
14
+ st.title("Sentiment Analysis")
 
 
15
 
16
  #subtitle
17
+ st.markdown("## A selection of popular sentiment analysis models - hosted on 🤗 Spaces")
18
 
19
  model_name = st.selectbox(
20
  'Select a pre-trained model',
 
25
  ],
26
  )
27
 
28
+ input_sentences = st.text_area("Sentences", value=demo_phrases, height=200)
29
 
30
  data = input_sentences.split('\n')
31
 
32
  if st.button("Classify"):
33
+ st.write("Please allow a few minutes for the model to run/download")
34
+ for i in range(len(data)):
35
+ j = classify(model_name.strip(), data[i])[0]
36
  sentiment = j['label']
37
  confidence = j['score']
38
+ st.write(f"{i}. {data[i]} :: Classification - {sentiment} with confidence {confidence}")
39
 
40
 
41
  st.markdown("Link to the app - [image-to-text-app on 🤗 Spaces](https://huggingface.co/spaces/Amrrs/image-to-text-app)")