File size: 1,258 Bytes
739c1d2
 
 
 
 
 
 
 
b8b7834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
739c1d2
 
 
 
 
 
 
c0ed7a4
739c1d2
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import gradio as gr
import translators as ts


def blog_gen(phrase):
    ts.google
    ts._google.language_map
    eng_de = ts.google(phrase, from_language='en', to_language='de')
    eng_ar = ts.google(phrase, from_language='en', to_language='ar')
    eng_fr = ts.google(phrase, from_language='en', to_language='fr')
    eng_zh = ts.google(phrase, from_language='en', to_language='zh')
    eng_ur = ts.google(phrase, from_language='en', to_language='ur')
    eng_sv = ts.google(phrase, from_language='en', to_language='sv')

    de_eng = ts.google(eng_de, from_language='de', to_language='en')
    de_ar = ts.google(eng_ar, from_language='ar', to_language='en')
    de_fr = ts.google(eng_fr, from_language='fr', to_language='en')
    de_zh = ts.google(eng_zh, from_language='zh', to_language='en')
    de_ur = ts.google(eng_ur, from_language='ur', to_language='en')
    de_sv = ts.google(eng_sv, from_language='sv', to_language='en')

    return de_eng,de_ar,de_fr,de_zh,de_ur,de_sv


iface = gr.Interface(fn=blog_gen,
                     inputs=[
                         gr.inputs.Textbox(
                             lines=2, placeholder=None, label='Sentence'),
                     ],
                     outputs="text")
iface.launch()