Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
|
|
7 |
import requests, os
|
8 |
|
9 |
gradio_client = GrClient(os.environ.get('GrClient_url'))
|
10 |
-
translator =
|
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,
|
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
|