Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from utils.translator import translate_text | |
| from utils.tts import text_to_speech | |
| from utils.osmanli_info import get_random_info | |
| def process_text(osmanlica_input): | |
| if not osmanlica_input.strip(): | |
| return "Lütfen metin giriniz.", None, get_random_info() | |
| translated = translate_text(osmanlica_input) | |
| audio_file = text_to_speech(translated) | |
| info = get_random_info() | |
| return translated, audio_file, info | |
| demo = gr.Interface( | |
| fn=process_text, | |
| inputs=gr.Textbox(label="Osmanlıca Metin Giriniz"), | |
| outputs=[ | |
| gr.Textbox(label="Çevrilmiş Türkçe Metin"), | |
| gr.Audio(label="Sesli Çıktı"), | |
| gr.Textbox(label="Osmanlı Tarihinden Bilgi") | |
| ], | |
| title="🕌 Osmanlıca Günümüz Türkçesine Çeviri", | |
| description="Osmanlıca metinleri günümüz Türkçesine çeviren, sesli çıktı veren ve Osmanlı tarihi hakkında bilgiler sunan uygulama." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |