sagar4tech's picture
Update app.py
eab793d verified
raw
history blame
509 Bytes
from diffusers import StableDiffusionPipeline
import torch
# Provide the url to model id
url = "runwayml/stable-diffusion-v1-5"
# Load the safetensor model
pipe = DiffusionPipeline.from_pretrained(model_file_path, use_safetensors=True )
pipe = pipe.to("mps")
def predict(text):
# Ensure pipe(text) returns the correct output format
generated_image = pipe(text).images[0]
return generated_image
iface = gr.Interface(
fn=predict,
inputs='text',
outputs='image',
)
iface.launch()