import gradio as gr import torch models =["CompVis/stable-diffusion-v1-4", "runwayml/stable-diffusion-v1-5", "stabilityai/stable-diffusion-2-1", "stabilityai/stable-diffusion-2-1-base"] title="Creating Pictures for Your Activities" description="Input your sentence(s) about your activity, submit and the computer will create a picture. To create a better picture, try adding more ideas and details. For example, you can add more nouns, adjectives, prepositions of time and time words." examples=[ ["First, we will run in Regent’s Park because we all love keeping fit while on holiday."], ["Second, we will visit a cafe as we like drinking coffee and writing. We can take many nice photos!"], ["Third, we must spend time to drink some local beer in a popular restaurant."] ] gr.Interface.load("huggingface/runwayml/stable-diffusion-v1-5", title=title, description=description, examples=examples, live=False,preprocess=True, postprocess=False).launch() #import diffusers #import streamlit as st #device = "cpu" #from diffusers import StableDiffusionPipeline #pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision = "fp16", use_auth_token = st.secrets["USER_TOKEN"]) #pipe = pipe.to("cpu") #from PIL import Image #import torch #def StableDiffusionPipeline (prompt, Guide, iSteps, seed): # generator = torch.Generator("cpu").manual_seed(seed) # image = pipe(prompt, num_inference_steps = iSteps, guidence_scale = Guide).images[0] # return image #iface = gr.Interface(fn = StableDiffusionPipeline, inputs = [ # gr.Textbox(label = 'Prompt Input Text'), # gr.Slider(2, 15, value = 7, label = 'Guidence Scale'), # gr.Slider(10, 100, value = 25, step = 1, label = 'Number of Iterations'), # gr.Slider( # label = "Seed", # minimum = 0, # maximum = 2147483647, # step = 1, # randomize = True) # ], # outputs = 'image') #iface.launch()