ldhldh commited on
Commit
6b65fd5
Β·
1 Parent(s): b300a18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import inspect
4
  from gradio import routes
5
  from typing import List, Type
6
  from googletrans import Translator
 
7
 
8
  gradio_client = GrClient(GrClient_url)
9
  translator = Translator()
@@ -28,8 +29,14 @@ routes.get_types = get_types
28
 
29
  # App code
30
  def mbti(x):
31
-
32
- return 0
 
 
 
 
 
 
33
 
34
  def chat(x):
35
  result = gradio_client.predict(
@@ -46,7 +53,7 @@ def chat(x):
46
  def yn(x):
47
  result = gradio_client.predict(
48
  x, # str representing input in 'User input' Textbox component
49
- fn_index=2
50
  )
51
  return result
52
 
 
4
  from gradio import routes
5
  from typing import List, Type
6
  from googletrans import Translator
7
+ import requests
8
 
9
  gradio_client = GrClient(GrClient_url)
10
  translator = Translator()
 
29
 
30
  # App code
31
  def mbti(x):
32
+ t = translator.translate(x, src='ko', dest='en').text
33
+ str_trans = re.sub('[-=+,#/\?:^.@*\"β€»~ㆍ!γ€β€˜|\(\)\[\]`\'…》\”\β€œ\’·]', '', t)
34
+ result = gradio_client.predict(
35
+ x, # str representing input in 'User input' Textbox component
36
+ fn_index=2
37
+ )
38
+
39
+ return result
40
 
41
  def chat(x):
42
  result = gradio_client.predict(
 
53
  def yn(x):
54
  result = gradio_client.predict(
55
  x, # str representing input in 'User input' Textbox component
56
+ fn_index=1
57
  )
58
  return result
59