import gradio as gr from huggingface_hub import hf_hub_download from safetensors.torch import load_file from PIL import Image from model import * def generate_image(prompt): return prompt_to_img(prompt)[0] # Gradio Interface description = """ This demo utilizes a specialized variant of the Stable Diffusion model designed for multilingual text-to-image synthesis. In response to the observed underperformance of existing models on languages beyond English, this project introduces the Multilingual Stable Diffusion, providing a more inclusive solution for diverse linguistic contexts. Link to Github repo: https://github.com/NajlaaNawaii/Multilingual-Stable-Diffusion-Towards-more-Inclusive-Text-To-Image-Synthesis """ with gr.Blocks(css="style.css") as demo: gr.HTML("

Multilingual Stable Diffusion 🧨

") gr.Markdown(description) with gr.Group(): with gr.Row(): prompt = gr.Textbox(label='Enter your prompt', scale=8) submit = gr.Button(scale=1, variant='primary') img = gr.Image(label='Generated Image') prompt.submit(fn=generate_image, inputs=[prompt], outputs=img, ) submit.click(fn=generate_image, inputs=[prompt], outputs=img, ) demo.queue().launch()