Spaces:
Running
Running
Update apis/chat_api.py
Browse files- apis/chat_api.py +4 -4
apis/chat_api.py
CHANGED
@@ -39,7 +39,7 @@ class ChatAPIApp:
|
|
39 |
default="en",
|
40 |
description="(str) `en`",
|
41 |
)
|
42 |
-
|
43 |
default="Hello",
|
44 |
description="(str) `Text for translate`",
|
45 |
)
|
@@ -57,12 +57,12 @@ class ChatAPIApp:
|
|
57 |
to_lang = item.to_language
|
58 |
|
59 |
|
60 |
-
|
61 |
item_response = {
|
62 |
"from_language": item.from_language,
|
63 |
"to_language": item.to_language,
|
64 |
-
"text": item.
|
65 |
-
"translate":
|
66 |
}
|
67 |
json_compatible_item_data = jsonable_encoder(item_response)
|
68 |
return JSONResponse(content=json_compatible_item_data)
|
|
|
39 |
default="en",
|
40 |
description="(str) `en`",
|
41 |
)
|
42 |
+
input_text: str = Field(
|
43 |
default="Hello",
|
44 |
description="(str) `Text for translate`",
|
45 |
)
|
|
|
57 |
to_lang = item.to_language
|
58 |
|
59 |
|
60 |
+
translated = translator.translate(item.input_text, dest=to_lang, src=from_lang)
|
61 |
item_response = {
|
62 |
"from_language": item.from_language,
|
63 |
"to_language": item.to_language,
|
64 |
+
"text": item.input_text,
|
65 |
+
"translate": translated
|
66 |
}
|
67 |
json_compatible_item_data = jsonable_encoder(item_response)
|
68 |
return JSONResponse(content=json_compatible_item_data)
|