File size: 1,096 Bytes
26d34af
62c5e2c
 
 
26d34af
62c5e2c
 
 
26d34af
 
 
 
 
62c5e2c
 
 
7af0f9b
 
 
 
 
 
 
 
62c5e2c
 
 
 
 
 
 
 
 
 
 
 
 
 
7af0f9b
62c5e2c
 
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
37
38
39
40
41
42
from unittest import result
import gradio as gr
from crh_transliterator.transliterator import transliterate
from crh_preprocessor.preprocessor import preprocess
from datetime import datetime


def tts(text: str) -> str:
    result = transliterate(text)
    text = preprocess(result)
    print("============================")
    print("Original text:", text)
    print("Time:", datetime.utcnow())
    return text


badge = (
    "https://visitor-badge-reloaded.herokuapp.com/badge?page_id=robinhad.qirimli-tts"
)

with open("README.md") as file:
    article = file.read()
    article = article[article.find("---\n", 4) + 5 : :]

iface = gr.Interface(
    fn=tts,
    inputs=[
        gr.components.Textbox(
            label="Input",
            value="Please input your sentence.",
        ),
    ],
    outputs="text",
    examples=[
        ["Selâm! İşler nasıl?"],
        ["Sağlıqnen qalıñız! Sağlıqnen barıñız! "],
        ["Селям! Ишлер насыл?"],
    ],
    article=article + f'\n  <center><img src="{badge}" alt="visitors badge"/></center>',
)
iface.launch()