tennyson commited on
Commit
e5928bf
1 Parent(s): 5d0c67a

Add more example

Browse files
Files changed (42) hide show
  1. __pycache__/share_btn.cpython-38.pyc +0 -0
  2. app.py +8 -13
  3. examples/image/2022-11-06-20-59-08.png +0 -0
  4. examples/image/2022-11-06-21-00-00.png +0 -0
  5. examples/image/2022-11-06-21-03-19.png +0 -0
  6. examples/image/2022-11-06-21-07-27.png +0 -0
  7. examples/image/2022-11-06-21-09-58.png +0 -0
  8. examples/image/2022-11-06-21-12-29.png +0 -0
  9. examples/image/2022-11-06-21-15-44.png +0 -0
  10. examples/image/2022-11-06-21-17-49.png +0 -0
  11. examples/image/2022-11-08-14-26-59.png +0 -0
  12. examples/image/2022-11-08-14-47-07.png +0 -0
  13. examples/image/2022-11-10-14-59-25.png +0 -0
  14. examples/image/2022-11-11-20-35-20.png +0 -0
  15. examples/image/2022-11-11-20-37-23.png +0 -0
  16. examples/image/2022-11-11-20-38-43.png +0 -0
  17. examples/image/2022-11-16-20-26-55.png +0 -0
  18. examples/image/2022-11-16-20-29-20.png +0 -0
  19. examples/image/2022-11-16-20-35-06.png +0 -0
  20. examples/image/2022-11-16-20-36-18.png +0 -0
  21. examples/image/2022-11-16-20-45-09.png +0 -0
  22. examples/image/2022-11-16-21-14-51.png +0 -0
  23. examples/image/2022-11-16-21-18-42.png +0 -0
  24. examples/image/2022-11-16-21-25-51.png +0 -0
  25. examples/image/2022-11-16-21-29-45.png +0 -0
  26. examples/image/2022-11-16-21-38-59.png +0 -0
  27. examples/image/2022-11-18-15-31-31.png +0 -0
  28. examples/reference/0b39c82d428c1c0a8d56bfa27a85c518.jpg +0 -0
  29. examples/reference/animal-4137865_1920.jpg +0 -0
  30. examples/reference/big-ben-7116305_1920.jpg +0 -0
  31. examples/reference/blackbird-7543630_1920.jpg +0 -0
  32. examples/reference/car-1283947_1920.jpg +0 -0
  33. examples/reference/car-4393990_1920.jpg +0 -0
  34. examples/reference/dog-5584135_1920.jpg +0 -0
  35. examples/reference/dog-7317820_1920.jpg +0 -0
  36. examples/reference/dolphin-1818853_1920.jpg +0 -0
  37. examples/reference/korea-7366036_1920.jpg +0 -0
  38. examples/reference/new-york-1590176_1920.jpg +0 -0
  39. examples/reference/puppy-4608266.jpg +0 -0
  40. examples/reference/teddy-1085164_1920.jpg +0 -0
  41. examples/reference/vw-4016326_1920.jpg +0 -0
  42. examples/reference/welsh-corgi-pembroke-4246905_1920.jpg +0 -0
__pycache__/share_btn.cpython-38.pyc ADDED
Binary file (7.02 kB). View file
 
app.py CHANGED
@@ -94,14 +94,10 @@ css = '''
94
  }
95
  '''
96
  example={}
97
- for i in range(1,4):
98
- ex_image_path='examples/image/example_'+str(i)+'.png'
99
- ex_mask_path='examples/mask/example_'+str(i)+'.png'
100
- ex_reference_path='examples/reference/example_'+str(i)+'.jpg'
101
- ex_image=Image.open(ex_image_path)
102
- ex_mask=Image.open(ex_mask_path)
103
- ex_reference=Image.open(ex_reference_path)
104
- example[i]={'image':{'image':ex_image,'mask':ex_mask},'reference':ex_reference}
105
 
106
 
107
  image_blocks = gr.Blocks(css=css)
@@ -134,11 +130,10 @@ with image_blocks as demo:
134
 
135
 
136
  with gr.Row():
137
- gr.Examples([
138
- ['examples/image/example_2.png', 'examples/reference/example_2.jpg',5,50],
139
- ['examples/image/example_3.png', 'examples/reference/example_3.jpg',5,50],
140
- ['examples/image/example_1.png', 'examples/reference/example_1.jpg',5,50],
141
- ], inputs=[image, reference, guidance, steps])
142
 
143
  btn.click(fn=predict, inputs=[image, reference, guidance, seed, steps], outputs=[image_out, community_icon, loading_icon, share_button])
144
  share_button.click(None, [], [], _js=share_js)
 
94
  }
95
  '''
96
  example={}
97
+ ref_dir='examples/reference'
98
+ image_dir='examples/image'
99
+ ref_list=[os.path.join(ref_dir,file) for file in os.listdir(ref_dir)]
100
+ image_list=[os.path.join(image_dir,file) for file in os.listdir(image_dir)]
 
 
 
 
101
 
102
 
103
  image_blocks = gr.Blocks(css=css)
 
130
 
131
 
132
  with gr.Row():
133
+ with gr.Column():
134
+ gr.Examples(image_list, inputs=[image],label="Examples - Source Image",examples_per_page=12)
135
+ with gr.Column():
136
+ gr.Examples(ref_list, inputs=[reference],label="Examples - Reference Image",examples_per_page=12)
 
137
 
138
  btn.click(fn=predict, inputs=[image, reference, guidance, seed, steps], outputs=[image_out, community_icon, loading_icon, share_button])
139
  share_button.click(None, [], [], _js=share_js)
examples/image/2022-11-06-20-59-08.png ADDED
examples/image/2022-11-06-21-00-00.png ADDED
examples/image/2022-11-06-21-03-19.png ADDED
examples/image/2022-11-06-21-07-27.png ADDED
examples/image/2022-11-06-21-09-58.png ADDED
examples/image/2022-11-06-21-12-29.png ADDED
examples/image/2022-11-06-21-15-44.png ADDED
examples/image/2022-11-06-21-17-49.png ADDED
examples/image/2022-11-08-14-26-59.png ADDED
examples/image/2022-11-08-14-47-07.png ADDED
examples/image/2022-11-10-14-59-25.png ADDED
examples/image/2022-11-11-20-35-20.png ADDED
examples/image/2022-11-11-20-37-23.png ADDED
examples/image/2022-11-11-20-38-43.png ADDED
examples/image/2022-11-16-20-26-55.png ADDED
examples/image/2022-11-16-20-29-20.png ADDED
examples/image/2022-11-16-20-35-06.png ADDED
examples/image/2022-11-16-20-36-18.png ADDED
examples/image/2022-11-16-20-45-09.png ADDED
examples/image/2022-11-16-21-14-51.png ADDED
examples/image/2022-11-16-21-18-42.png ADDED
examples/image/2022-11-16-21-25-51.png ADDED
examples/image/2022-11-16-21-29-45.png ADDED
examples/image/2022-11-16-21-38-59.png ADDED
examples/image/2022-11-18-15-31-31.png ADDED
examples/reference/0b39c82d428c1c0a8d56bfa27a85c518.jpg ADDED
examples/reference/animal-4137865_1920.jpg ADDED
examples/reference/big-ben-7116305_1920.jpg ADDED
examples/reference/blackbird-7543630_1920.jpg ADDED
examples/reference/car-1283947_1920.jpg ADDED
examples/reference/car-4393990_1920.jpg ADDED
examples/reference/dog-5584135_1920.jpg ADDED
examples/reference/dog-7317820_1920.jpg ADDED
examples/reference/dolphin-1818853_1920.jpg ADDED
examples/reference/korea-7366036_1920.jpg ADDED
examples/reference/new-york-1590176_1920.jpg ADDED
examples/reference/puppy-4608266.jpg ADDED
examples/reference/teddy-1085164_1920.jpg ADDED
examples/reference/vw-4016326_1920.jpg ADDED
examples/reference/welsh-corgi-pembroke-4246905_1920.jpg ADDED