Spaces:
Configuration error
Configuration error
File size: 1,934 Bytes
022e492 6ac6448 89dff8c 4f3c91a fd5b548 6e00fea fd5b548 9cd7dc3 b504835 89dff8c |
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 39 40 41 |
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/stabilityai/stable-diffusion-2-1-base", 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() |