uripper commited on
Commit
e521b52
1 Parent(s): 08aced1

trimmed broken code

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py CHANGED
@@ -1,45 +1,20 @@
1
  import gradio as gr
2
  from diffusers import PNDMPipeline, PNDMScheduler
3
- import random
4
 
5
 
6
  scheduler = PNDMScheduler(num_train_timesteps=1100)
7
  pipeline = PNDMPipeline.from_pretrained("uripper/GIANNIS", scheduler=scheduler)
8
 
9
- # num_imgs = len(os.listdir("\stored_images"))
10
- # imgs = os.listdir("\stored_images")
11
-
12
 
13
  def generate_img():
14
- random_words = ["blue", "bear", "math", "pi", "apple", "cheese", "monkey", "yellow", "grape", "banana", "orange", "dog", "cat", "fish", "bird", "mouse", "horse", "cow", "sheep", "pig", "chicken", "duck", "frog", "snake", "turtle", "elephant", "lion", "tiger", "giraffe", "zebra", "monkey", "ant", "bee", "butterfly", "camel", "crocodile", "dolphin", "duck", "eagle", "fish", "flamingo", "fox", "frog", "giraffe", "goat", "goldfish", "hamster", "hippopotamus", "horse", "kangaroo", "kitten", "lion", "lobster", "monkey", "octopus", "owl", "panda", "parrot", "penguin", "pig", "puppy", "rabbit", "raccoon", "rhinoceros", "scorpion", "seal", "shark", "snail", "snake", "spider", "squirrel", "swan", "tiger", "whale", "wolf", "zebra"]
15
- ran_word_1 = random.choice(random_words)
16
- ran_word_2 = random.choice(random_words)
17
- ran_word_3 = random.choice(random_words)
18
- ran_num = str(random.randint(1, 100))
19
- ran_num2 = str(random.randint(1, 100))
20
- filename = ran_word_1 + "_" + ran_num + "_" + ran_word_2 + "_" + ran_num2 + "_" + ran_word_3
21
-
22
-
23
  try:
24
  pipeline.to("cuda")
25
  except:
26
  pass
27
  images= pipeline().images
28
  im = images[0]
29
- # im.save(f"GIANNIS\stored_images\{filename}.png")
30
  return im
31
 
32
- # def show_random_image(num_imgs = num_imgs, imgs = imgs):
33
- # ran_img = random.randint(1, num_imgs)-1
34
- # display_img = "GIANNIS\\stored_images\\"+imgs[ran_img]
35
- # return PIL.Image.open(display_img)
36
-
37
- # for i in range(100):
38
- # generate_img()
39
- # When a user clicks button, pipeline will generate an image
40
-
41
- # iface = gr.Interface(fn=show_random_image, inputs=[], outputs="image")
42
-
43
  iface = gr.Interface(fn=generate_img, inputs=[], outputs="image")
44
 
45
  iface.launch()
 
1
  import gradio as gr
2
  from diffusers import PNDMPipeline, PNDMScheduler
 
3
 
4
 
5
  scheduler = PNDMScheduler(num_train_timesteps=1100)
6
  pipeline = PNDMPipeline.from_pretrained("uripper/GIANNIS", scheduler=scheduler)
7
 
 
 
 
8
 
9
  def generate_img():
 
 
 
 
 
 
 
 
 
10
  try:
11
  pipeline.to("cuda")
12
  except:
13
  pass
14
  images= pipeline().images
15
  im = images[0]
 
16
  return im
17
 
 
 
 
 
 
 
 
 
 
 
 
18
  iface = gr.Interface(fn=generate_img, inputs=[], outputs="image")
19
 
20
  iface.launch()