Saurabhgk18's picture
Update app.py
6374fdd
Raw History Blame Contribute Delete
827 Bytes
from diffusers import StableDiffusionPipeline
import torch
from transformers.utils.hub import move_cache
move_cache()
sdmodel=['stabilityai/stable-diffusion-2-1']
def T2I(Prompt,model):
model_id = model
pipe = StableDiffusionPipeline.from_pretrained(model_id)
pipe = pipe.to("cpu")
prompt = Prompt
image = pipe(prompt).images[0]
return image
desc = "The Models are running on Low processing power CPU'S. Which can take longer time to load!!!"
import gradio as gr
# css = ".gradio-container {background: rgb(0, 166, 228)}"
interface = gr.Interface(fn=T2I,
inputs=["text", gr.Dropdown(sdmodel)],
outputs="image",
title='Advanced Stable DiFFusion',
description=desc
)
interface.launch()