Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,12 +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 |
|
8 |
import requests, os
|
9 |
|
10 |
gradio_client = GrClient(os.environ.get('GrClient_url'))
|
11 |
-
translator =
|
12 |
# Monkey patch
|
13 |
def get_types(cls_set: List[Type], component: str):
|
14 |
docset = []
|
@@ -30,7 +30,7 @@ routes.get_types = get_types
|
|
30 |
|
31 |
# App code
|
32 |
def mbti(x):
|
33 |
-
t = translator.translate(x,
|
34 |
str_trans = re.sub('[-=+,#/\?:^.@*\"※~ㆍ!』‘|\(\)\[\]`\'…》\”\“\’·]', '', t)
|
35 |
result = gradio_client.predict(
|
36 |
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 googletrans import Translator
|
7 |
|
8 |
import requests, os
|
9 |
|
10 |
gradio_client = GrClient(os.environ.get('GrClient_url'))
|
11 |
+
translator = Translator()
|
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, src='ko', dest='en')
|
34 |
str_trans = re.sub('[-=+,#/\?:^.@*\"※~ㆍ!』‘|\(\)\[\]`\'…》\”\“\’·]', '', t)
|
35 |
result = gradio_client.predict(
|
36 |
str_trans, # str representing input in 'User input' Textbox component
|