Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,13 +32,22 @@ import requests
|
|
32 |
|
33 |
def translate_zh_to_en(zh_text):
|
34 |
assert type(zh_text) == type("")
|
|
|
35 |
response = requests.post("https://svjack-translate-chinese-to-english.hf.space/run/predict", json={
|
36 |
"data": [
|
37 |
zh_text,
|
38 |
]}).json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
data = response["data"]
|
40 |
data = data[0]
|
41 |
-
data = data["English Question"]
|
|
|
42 |
return data
|
43 |
|
44 |
def translate_en_to_zh(en_text):
|
|
|
32 |
|
33 |
def translate_zh_to_en(zh_text):
|
34 |
assert type(zh_text) == type("")
|
35 |
+
'''
|
36 |
response = requests.post("https://svjack-translate-chinese-to-english.hf.space/run/predict", json={
|
37 |
"data": [
|
38 |
zh_text,
|
39 |
]}).json()
|
40 |
+
'''
|
41 |
+
response = requests.post("https://svjack-ctranslate.hf.space/run/predict", json={
|
42 |
+
"data": [
|
43 |
+
zh_text,
|
44 |
+
"zh",
|
45 |
+
"en",
|
46 |
+
]}).json()
|
47 |
data = response["data"]
|
48 |
data = data[0]
|
49 |
+
#data = data["English Question"]
|
50 |
+
data = data["Target Question"]
|
51 |
return data
|
52 |
|
53 |
def translate_en_to_zh(en_text):
|