davidlee1102 commited on
Commit
3b096e3
1 Parent(s): 535a17e
Files changed (3) hide show
  1. app.py +9 -9
  2. pre_processing_data.py +4 -0
  3. requirements.txt +1 -0
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import streamlit as st
2
 
3
- # from emotion_model import emotion_predict
4
- name = st.text_input("Enter your sentence here")
5
 
 
6
  if (st.button('Submit')):
7
  result = name.title()
8
- a = "Hi, this is morning bro, happy to see you"
9
- # try:
10
- # result_check = emotion_predict(a)
11
- # except Exception as E:
12
- # result_check = "Error"
13
- # print(E)
14
- st.success(a)
 
1
  import streamlit as st
2
 
3
+ from emotion_model import emotion_predict
 
4
 
5
+ name = st.text_input("Enter your sentence here")
6
  if (st.button('Submit')):
7
  result = name.title()
8
+ try:
9
+ result_check = emotion_predict(result)
10
+ except Exception as E:
11
+ result_check = "Error"
12
+ print(E)
13
+
14
+ st.success(result_check)
pre_processing_data.py CHANGED
@@ -2,6 +2,7 @@ import contractions
2
  import spacy
3
  import nltk
4
  import pickle
 
5
 
6
  from nltk.corpus import stopwords
7
  from nltk.tokenize import RegexpTokenizer
@@ -12,6 +13,9 @@ nltk.download('wordnet')
12
  nltk.download('omw-1.4')
13
  nltk.download('stopwords')
14
  nltk.download('averaged_perceptron_tagger')
 
 
 
15
  nlp = spacy.load("en_core_web_sm")
16
 
17
  stop_words = set(stopwords.words('english'))
 
2
  import spacy
3
  import nltk
4
  import pickle
5
+ import subprocess
6
 
7
  from nltk.corpus import stopwords
8
  from nltk.tokenize import RegexpTokenizer
 
13
  nltk.download('omw-1.4')
14
  nltk.download('stopwords')
15
  nltk.download('averaged_perceptron_tagger')
16
+
17
+ model_url = "https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl"
18
+ subprocess.run(["pip", "install", model_url])
19
  nlp = spacy.load("en_core_web_sm")
20
 
21
  stop_words = set(stopwords.words('english'))
requirements.txt CHANGED
@@ -209,3 +209,4 @@ wheel==0.38.4
209
  widgetsnbextension==4.0.5
210
  wrapt==1.14.1
211
  zipp==3.15.0
 
 
209
  widgetsnbextension==4.0.5
210
  wrapt==1.14.1
211
  zipp==3.15.0
212
+ https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl