|
import gradio as gr |
|
trToEng = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tr-en") |
|
text_to_image = gr.Interface.load("huggingface/runwayml/stable-diffusion-v1-5") |
|
|
|
with gr.Blocks() as demo: |
|
title = "Translate from Turkish to English and English text to image" |
|
|
|
de_text = gr.Textbox(placeholder="Türkçe cümle") |
|
translate_btn = gr.Button("translate from Turkish to english") |
|
|
|
eng_text = gr.Textbox(label="ingilizce") |
|
translate_btn.click(trToEng, de_text, eng_text) |
|
|
|
text_to_image_btn = gr.Button("text to image") |
|
|
|
out = gr.Image() |
|
|
|
text_to_image_btn.click(text_to_image, eng_text, out) |
|
|
|
demo.launch() |
|
|