sashavor commited on
Commit
0ba5e9f
1 Parent(s): ebf0660

adding functionality yay!

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -4,19 +4,20 @@ from PIL import Image
4
  import pandas as pd
5
 
6
  def open_ims(adj, group):
7
- if adj != '':
8
- if adj[0] in vowels:
9
- dirname='images/'+'Photo_portrait_of_an_'+ adj+'_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
 
 
 
10
  else:
11
- dirname='images/'+'Photo_portrait_of_a_'+ adj+ '_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
12
- else:
13
- if group[0] in vowels:
14
- dirname='images/'+'Photo_portrait_of_an_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
15
- else:
16
- dirname='images/'+'Photo_portrait_of_a_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
17
- imnames= os.listdir(dirname)
18
- images = [(Image.open(dirname+name)) for name in imnames]
19
- return images[:9]
20
 
21
 
22
  vowels = ["a","e","i","o","u"]
@@ -48,4 +49,6 @@ with gr.Blocks() as demo:
48
  #demo.load(random_image, None, [images])
49
  choice1.change(open_ims, [adj1,choice1], [images1])
50
  choice2.change(open_ims, [adj2,choice2], [images2])
 
 
51
  demo.launch()
 
4
  import pandas as pd
5
 
6
  def open_ims(adj, group):
7
+ if group != '':
8
+ if adj != '':
9
+ if adj[0] in vowels:
10
+ dirname='images/'+'Photo_portrait_of_an_'+ adj+'_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
11
+ else:
12
+ dirname='images/'+'Photo_portrait_of_a_'+ adj+ '_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
13
  else:
14
+ if group[0] in vowels:
15
+ dirname='images/'+'Photo_portrait_of_an_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
16
+ else:
17
+ dirname='images/'+'Photo_portrait_of_a_'+ group.replace(' ','_')+'/Seed_'+ str(seed_choice)+'/'
18
+ imnames= os.listdir(dirname)
19
+ images = [(Image.open(dirname+name)) for name in imnames]
20
+ return images[:9]
 
 
21
 
22
 
23
  vowels = ["a","e","i","o","u"]
 
49
  #demo.load(random_image, None, [images])
50
  choice1.change(open_ims, [adj1,choice1], [images1])
51
  choice2.change(open_ims, [adj2,choice2], [images2])
52
+ adj1.change(open_ims, [adj1,choice1], [images1])
53
+ adj2.change(open_ims, [adj2,choice2], [images2])
54
  demo.launch()