-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinjector.py
More file actions
34 lines (26 loc) · 1007 Bytes
/
injector.py
File metadata and controls
34 lines (26 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from structures import Slide, Image
from create_slideshow_injector import CreateSlideshowInjector
from max_vertical import max_vertical
from output import output
if __name__ == "__main__":
filename = "data/b_lovely_landscapes.txt"
# filename = "data/c_memorable_moments.txt"
# filename = "data/a_example.txt"
with open(filename, 'r') as images_pointer:
image_strings = images_pointer.readlines()[1:]
vertical_images = set()
slides = set()
for id, image_string in enumerate(image_strings):
image = Image(image_string.strip(), id)
if image.orientation == "V":
vertical_images.add(image)
else:
slide = Slide([image])
slides.add(slide)
slides.update(max_vertical(vertical_images))
print("Slides in slideshow", len(slides))
s = CreateSlideshowInjector(slides)
slideshow, algoscore = s.create()
print("Algo Score", algoscore)
# print(slideshow)
output(slideshow, "Injector_B.txt")