darwincharles123321 commited on
Commit
09c538a
·
verified ·
1 Parent(s): 0083770

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from utils.translator import translate_text
3
+ from utils.tts import text_to_speech
4
+ from utils.osmanli_info import get_random_info
5
+
6
+ def process_text(osmanlica_input):
7
+ if not osmanlica_input.strip():
8
+ return "Lütfen metin giriniz.", None, get_random_info()
9
+
10
+ translated = translate_text(osmanlica_input)
11
+ audio_file = text_to_speech(translated)
12
+ info = get_random_info()
13
+
14
+ return translated, audio_file, info
15
+
16
+ demo = gr.Interface(
17
+ fn=process_text,
18
+ inputs=gr.Textbox(label="Osmanlıca Metin Giriniz"),
19
+ outputs=[
20
+ gr.Textbox(label="Çevrilmiş Türkçe Metin"),
21
+ gr.Audio(label="Sesli Çıktı"),
22
+ gr.Textbox(label="Osmanlı Tarihinden Bilgi")
23
+ ],
24
+ title="🕌 Osmanlıca Günümüz Türkçesine Çeviri",
25
+ description="Osmanlıca metinleri günümüz Türkçesine çeviren, sesli çıktı veren ve Osmanlı tarihi hakkında bilgiler sunan uygulama."
26
+ )
27
+
28
+ if __name__ == "__main__":
29
+ demo.launch()