ldhldh commited on
Commit
cf7a07e
1 Parent(s): 20a51eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,11 +3,12 @@ from gradio_client import Client as GrClient
3
  import inspect
4
  from gradio import routes
5
  from typing import List, Type
6
- from googletrans import Translator
 
7
  import requests, os
8
 
9
  gradio_client = GrClient(os.environ.get('GrClient_url'))
10
- translator = Translator(service_urls=['translate.google.com'])
11
  # Monkey patch
12
  def get_types(cls_set: List[Type], component: str):
13
  docset = []
@@ -29,7 +30,7 @@ routes.get_types = get_types
29
 
30
  # App code
31
  def mbti(x):
32
- t = translator.translate(x, src='ko', dest='en')
33
  str_trans = re.sub('[-=+,#/\?:^.@*\"※~ㆍ!』‘|\(\)\[\]`\'…》\”\“\’·]', '', t)
34
  result = gradio_client.predict(
35
  str_trans, # str representing input in 'User input' Textbox component
 
3
  import inspect
4
  from gradio import routes
5
  from typing import List, Type
6
+ from google_trans_new import google_translator
7
+
8
  import requests, os
9
 
10
  gradio_client = GrClient(os.environ.get('GrClient_url'))
11
+ translator = google_translator(service_urls=['translate.google.com'])
12
  # Monkey patch
13
  def get_types(cls_set: List[Type], component: str):
14
  docset = []
 
30
 
31
  # App code
32
  def mbti(x):
33
+ t = translator.translate(x, lang_src='ko', lang_dest='en')
34
  str_trans = re.sub('[-=+,#/\?:^.@*\"※~ㆍ!』‘|\(\)\[\]`\'…》\”\“\’·]', '', t)
35
  result = gradio_client.predict(
36
  str_trans, # str representing input in 'User input' Textbox component