Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import time
|
| 3 |
from deep_translator import GoogleTranslator
|
| 4 |
|
| 5 |
-
def tarjim(text, choice
|
| 6 |
-
progress(0, desc="Tarjima qilish boshlandi. Iltimos ozgina vaqt kuting...")
|
| 7 |
try:
|
| 8 |
if text and choice:
|
| 9 |
support_languages = GoogleTranslator().get_supported_languages(as_dict=True)
|
| 10 |
-
for i in progress.tqdm(range(100)):
|
| 11 |
-
time.sleep(0.01)
|
| 12 |
return GoogleTranslator(source='auto',target=support_languages[choice]).translate(text.replace('\n', ' '))
|
| 13 |
else:
|
| 14 |
return gr.Info("Kiritish maydoni bo'sh bo'lmasligi kerak %s" % text)
|
|
@@ -20,8 +16,14 @@ with gr.Blocks() as demo:
|
|
| 20 |
"""
|
| 21 |
# Tezkor tarjima!
|
| 22 |
Ma'lumotlarni tezkor tajima qilish uchun kiritish maydonini bo'sh qoldirmang.
|
|
|
|
| 23 |
""")
|
| 24 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
with gr.Column():
|
| 26 |
tanlash = gr.Dropdown(label='Tilni tanlang', choices=GoogleTranslator().get_supported_languages(), value='uzbek')
|
| 27 |
inp = gr.Textbox(label='kirish qismi', placeholder="Tarjima mantnini kiriting..." ,autofocus=True)
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from deep_translator import GoogleTranslator
|
| 3 |
|
| 4 |
+
def tarjim(text, choice):
|
|
|
|
| 5 |
try:
|
| 6 |
if text and choice:
|
| 7 |
support_languages = GoogleTranslator().get_supported_languages(as_dict=True)
|
|
|
|
|
|
|
| 8 |
return GoogleTranslator(source='auto',target=support_languages[choice]).translate(text.replace('\n', ' '))
|
| 9 |
else:
|
| 10 |
return gr.Info("Kiritish maydoni bo'sh bo'lmasligi kerak %s" % text)
|
|
|
|
| 16 |
"""
|
| 17 |
# Tezkor tarjima!
|
| 18 |
Ma'lumotlarni tezkor tajima qilish uchun kiritish maydonini bo'sh qoldirmang.
|
| 19 |
+
Hurmat bilan <a href="https://t.me/shohabbosdev">Shoh Abbos Ulug'murodov</a>
|
| 20 |
""")
|
| 21 |
with gr.Row():
|
| 22 |
+
with gr.Accordion(label='Deep Translator haqida...', open=False):
|
| 23 |
+
gr.Markdown("""
|
| 24 |
+
Ko'p tarjimonlar yordamida turli tillar o'rtasida sodda tarzda tarjima qilish uchun moslashuvchan BEPUL va CHEKSIZ vosita.
|
| 25 |
+
foydalanish juda oddiy <code>pip install deep-translator</code>
|
| 26 |
+
""")
|
| 27 |
with gr.Column():
|
| 28 |
tanlash = gr.Dropdown(label='Tilni tanlang', choices=GoogleTranslator().get_supported_languages(), value='uzbek')
|
| 29 |
inp = gr.Textbox(label='kirish qismi', placeholder="Tarjima mantnini kiriting..." ,autofocus=True)
|