Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
|
4 |
-
def ndps(description,lang="ru"):
|
5 |
-
detected_lang = "auto"
|
6 |
-
translator = GoogleTranslator(source=lang, target=detected_lang)
|
7 |
-
out=translator.translate(text=description)
|
8 |
-
translator = GoogleTranslator(source=detected_lang, target=lang)
|
9 |
-
if detected_lang == lang:
|
10 |
-
if detected_lang != 'auto':
|
11 |
-
response = "Sorry but I can't help you because I don't understand what you really need."
|
12 |
-
else:
|
13 |
-
translator = GoogleTranslator(source=f'{lang}', target=detected_lang)
|
14 |
-
response = translator.translate(text="Sorry but I can't help you because I don't understand what you really need.")
|
15 |
-
|
16 |
-
return response
|
17 |
-
return translator.translate(text=out)
|
18 |
|
19 |
-
demo = gr.Interface(fn=
|
20 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import NDPS
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
demo = gr.Interface(fn=NDPS, inputs="text", outputs="text")
|
6 |
demo.launch()
|