wiraindrak commited on
Commit
ce0b273
1 Parent(s): 24a7ce1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,6 +3,7 @@ import nltk.data
3
  import pandas as pd
4
  import matplotlib.pyplot as plt
5
  from googletrans import Translator
 
6
 
7
  nltk.download('punkt')
8
 
@@ -32,7 +33,7 @@ ner_pipeline = pipeline(
32
  grouped_entities=True
33
  )
34
 
35
- translator = Translator()
36
 
37
  def summ_t5(text):
38
  input_ids = tokenizer_t5.encode(text, return_tensors='pt')
@@ -74,14 +75,14 @@ def sentiment_df(text):
74
 
75
  def run(text):
76
  summ_ = summ_t5(text)
77
- summ_translated = translator.translate(summ_, src='id', dest='en')
78
  sent_ = sentiment_analysis(summ_translated )
79
  ner_ = ner(summ_)
80
  return summ_, sent_, ner_
81
 
82
  if __name__ == "__main__":
83
  with gr.Blocks() as demo:
84
- gr.Markdown("""<h1 style="text-align:center">Stock Analysis - Indonesia</h1>""")
85
 
86
  gr.Markdown(
87
  """
 
3
  import pandas as pd
4
  import matplotlib.pyplot as plt
5
  from googletrans import Translator
6
+ from google_trans_new import google_translator
7
 
8
  nltk.download('punkt')
9
 
 
33
  grouped_entities=True
34
  )
35
 
36
+ translator = google_translator()
37
 
38
  def summ_t5(text):
39
  input_ids = tokenizer_t5.encode(text, return_tensors='pt')
 
75
 
76
  def run(text):
77
  summ_ = summ_t5(text)
78
+ summ_translated = translator..transalate(summ_, lang_src='id',lang_tgt='en')
79
  sent_ = sentiment_analysis(summ_translated )
80
  ner_ = ner(summ_)
81
  return summ_, sent_, ner_
82
 
83
  if __name__ == "__main__":
84
  with gr.Blocks() as demo:
85
+ gr.Markdown("""<h1 style="text-align:center">Financial Statement Analysis - Indonesia</h1>""")
86
 
87
  gr.Markdown(
88
  """