sashavor commited on
Commit
777259c
β€’
1 Parent(s): a6726ed

initial app

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. app.py +27 -16
  2. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_1.jpg +0 -0
  3. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_10.jpg +0 -0
  4. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_2.jpg +0 -0
  5. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_3.jpg +0 -0
  6. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_4.jpg +0 -0
  7. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_5.jpg +0 -0
  8. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_6.jpg +0 -0
  9. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_7.jpg +0 -0
  10. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_8.jpg +0 -0
  11. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_9.jpg +0 -0
  12. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_1.jpg +0 -0
  13. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_10.jpg +0 -0
  14. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_2.jpg +0 -0
  15. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_3.jpg +0 -0
  16. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_4.jpg +0 -0
  17. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_5.jpg +0 -0
  18. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_6.jpg +0 -0
  19. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_7.jpg +0 -0
  20. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_8.jpg +0 -0
  21. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_9.jpg +0 -0
  22. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_1.jpg +0 -0
  23. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_10.jpg +0 -0
  24. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_2.jpg +0 -0
  25. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_3.jpg +0 -0
  26. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_4.jpg +0 -0
  27. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_5.jpg +0 -0
  28. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_6.jpg +0 -0
  29. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_7.jpg +0 -0
  30. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_8.jpg +0 -0
  31. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_9.jpg +0 -0
  32. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_1.jpg +0 -0
  33. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_10.jpg +0 -0
  34. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_2.jpg +0 -0
  35. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_3.jpg +0 -0
  36. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_4.jpg +0 -0
  37. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_5.jpg +0 -0
  38. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_6.jpg +0 -0
  39. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_7.jpg +0 -0
  40. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_8.jpg +0 -0
  41. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_9.jpg +0 -0
  42. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_1.jpg +0 -0
  43. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_10.jpg +0 -0
  44. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_2.jpg +0 -0
  45. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_3.jpg +0 -0
  46. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_4.jpg +0 -0
  47. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_5.jpg +0 -0
  48. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_6.jpg +0 -0
  49. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_7.jpg +0 -0
  50. {Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_8.jpg +0 -0
app.py CHANGED
@@ -1,28 +1,39 @@
1
  import gradio as gr
2
- import random
 
3
 
4
- def gen_ims(prompt, im_prompt=None, seed=None, n_steps=10, method='plms'):
5
- if seed == None :
6
- seed = random.randint(0, 10000)
7
- print( prompt, im_prompt, seed, n_steps)
8
- prompts = [prompt]
9
- im_prompts = []
10
- if im_prompt != None:
11
- im_prompts = [im_prompt]
12
- pil_ims = generate(n=1, prompts=prompts, images=im_prompts, seed=seed, steps=n_steps, method=method)
13
- return pil_ims[0]
14
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  with gr.Blocks() as demo:
17
  gr.Markdown("# Stable Diffusion Explorer")
18
- gr.Markdown("#### Try your hand at guessing the category of each image displayed, from the options provided. Compare your answers to that of a neural network trained on the dataset, and see if you can do better!")
 
19
  with gr.Row():
20
  with gr.Column():
21
- gr.inputs.Textbox(label="Text prompt"),
22
- gr.inputs.Image(optional=True, label="Image prompt", type='filepath'),
23
  with gr.Column():
24
- gr.inputs.Textbox(label="Text prompt"),
25
- gr.inputs.Image(optional=True, label="Image prompt", type='filepath'),
 
 
26
 
 
27
 
28
  demo.launch()
 
1
  import gradio as gr
2
+ import random, os
3
+ from PIL import Image
4
 
5
+ def open_ims(choice):
6
+ print(choice)
7
+ imnames = os.listdir('images/'+'Photo_portrait_of_a_'+choice.replace(' ',' ')+'/Seed_46267/')
8
+ images = [(Image.open(name)) for name in imnames]
9
+ return images
 
 
 
 
 
10
 
11
+ def random_image():
12
+ cat = random.choice(categories)
13
+ print(cat)
14
+ imnames = os.listdir('images/'+'Photo_portrait_of_a_'+choice.replace(' ',' ')+'/Seed_46267/')
15
+ ims = [(Image.open(name)) for name in imnames]
16
+ print(ims)
17
+ return ims
18
+
19
+ categories=os.listdir('images/')
20
+ categories = [c.replace('Photo_portrait_of_a_','').replace('_',' ') for c in categories]
21
+ print(categories)
22
 
23
  with gr.Blocks() as demo:
24
  gr.Markdown("# Stable Diffusion Explorer")
25
+ gr.Markdown("## TODO")
26
+ demo.load(random_image, None, images)
27
  with gr.Row():
28
  with gr.Column():
29
+ choice = gr.Dropdown(categories, label = "Choose a first category", interactive=True)
30
+ gr.Gallery(images, label="Images"),
31
  with gr.Column():
32
+ gr.Textbox(label="Text prompt"),
33
+ gr.Image(optional=True, label="Image prompt", type='filepath'),
34
+
35
+
36
 
37
+ choice.change(open_ims, [prompt], [images])
38
 
39
  demo.launch()
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_1.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_10.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_2.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_3.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_4.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_5.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_6.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_7.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_8.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_46267/Photo_portrait_of_a_doctor_image_9.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_1.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_10.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_2.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_3.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_4.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_5.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_6.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_7.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_8.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_48040/Photo_portrait_of_a_doctor_image_9.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_1.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_10.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_2.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_3.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_4.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_5.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_6.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_7.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_8.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_51237/Photo_portrait_of_a_doctor_image_9.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_1.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_10.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_2.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_3.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_4.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_5.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_6.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_7.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_8.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_54325/Photo_portrait_of_a_doctor_image_9.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_1.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_10.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_2.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_3.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_4.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_5.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_6.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_7.jpg RENAMED
File without changes
{Photo_portrait_of_a_doctor β†’ images/Photo_portrait_of_a_doctor}/Seed_60884/Photo_portrait_of_a_doctor_image_8.jpg RENAMED
File without changes