Spaces:
Runtime error
Runtime error
Commit
•
e161efd
1
Parent(s):
d554ae1
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
demo = gr.Interface(
|
7 |
-
fn=
|
8 |
-
inputs=
|
9 |
-
outputs=
|
10 |
)
|
11 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import dl_translate as dlt
|
3 |
+
mt = dlt.TranslationModel()
|
4 |
|
5 |
+
|
6 |
+
def translateapi(inputtext,from_lang,to_lang):
|
7 |
+
text_in = str(inputtext)
|
8 |
+
form = str(from_lang)
|
9 |
+
to = str(to_lang)
|
10 |
+
translation = mt.translate(text_in, source=form, target=to)
|
11 |
+
return translation
|
12 |
+
|
13 |
|
14 |
demo = gr.Interface(
|
15 |
+
fn=translateapi,
|
16 |
+
inputs=["text", "text", "text"],
|
17 |
+
outputs="text",
|
18 |
)
|
19 |
demo.launch()
|