File size: 1,362 Bytes
ff09d94 87ab5f6 ff09d94 87ab5f6 ff09d94 87ab5f6 ff09d94 87ab5f6 ff09d94 |
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 |
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("<h1><center>Multilingual Stable Diffusion 🧨</center></h1>")
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() |