Wootang01 commited on
Commit
89dff8c
1 Parent(s): 0763fc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -25
app.py CHANGED
@@ -1,26 +1,37 @@
1
  import gradio as gr
2
- import diffusers
3
- import streamlit as st
4
- device = "cpu"
5
- from diffusers import StableDiffusionPipeline
6
- pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision = "fp16", use_auth_token = st.secrets["USER_TOKEN"])
7
- pipe = pipe.to("cpu")
8
- from PIL import Image
9
- import torch
10
- def StableDiffusionPipeline (prompt, Guide, iSteps, seed):
11
- generator = torch.Generator("cpu").manual_seed(seed)
12
- image = pipe(prompt, num_inference_steps = iSteps, guidence_scale = Guide).images[0]
13
- return image
14
- iface = gr.Interface(fn = StableDiffusionPipeline, inputs = [
15
- gr.Textbox(label = 'Prompt Input Text'),
16
- gr.Slider(2, 15, value = 7, label = 'Guidence Scale'),
17
- gr.Slider(10, 100, value = 25, step = 1, label = 'Number of Iterations'),
18
- gr.Slider(
19
- label = "Seed",
20
- minimum = 0,
21
- maximum = 2147483647,
22
- step = 1,
23
- randomize = True)
24
- ],
25
- outputs = 'image')
26
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+
3
+ models =["CompVis/stable-diffusion-v1-4", "runwayml/stable-diffusion-v1-5", "stabilityai/stable-diffusion-2-1", "stabilityai/stable-diffusion-2-1-base"]
4
+
5
+ model_1=models[1]
6
+ model_2=models[2]
7
+ model_3=models[3]
8
+ model_4=models[4]
9
+
10
+ gr.Interface.load(f"models/{model_1}",live=False,preprocess=True, postprocess=False).launch()
11
+
12
+
13
+ #import diffusers
14
+ #import streamlit as st
15
+ #device = "cpu"
16
+ #from diffusers import StableDiffusionPipeline
17
+ #pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision = "fp16", use_auth_token = st.secrets["USER_TOKEN"])
18
+ #pipe = pipe.to("cpu")
19
+ #from PIL import Image
20
+ #import torch
21
+ #def StableDiffusionPipeline (prompt, Guide, iSteps, seed):
22
+ # generator = torch.Generator("cpu").manual_seed(seed)
23
+ # image = pipe(prompt, num_inference_steps = iSteps, guidence_scale = Guide).images[0]
24
+ # return image
25
+ #iface = gr.Interface(fn = StableDiffusionPipeline, inputs = [
26
+ # gr.Textbox(label = 'Prompt Input Text'),
27
+ # gr.Slider(2, 15, value = 7, label = 'Guidence Scale'),
28
+ # gr.Slider(10, 100, value = 25, step = 1, label = 'Number of Iterations'),
29
+ # gr.Slider(
30
+ # label = "Seed",
31
+ # minimum = 0,
32
+ # maximum = 2147483647,
33
+ # step = 1,
34
+ # randomize = True)
35
+ # ],
36
+ # outputs = 'image')
37
+ #iface.launch()