Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,9 @@ celeb_folder = {
|
|
27 |
|
28 |
curr_size = 256
|
29 |
def Clear(prev_size, photo=celeb_list[1], folder=celeb_folder, next=False):
|
|
|
|
|
|
|
30 |
if next:
|
31 |
index = celeb_list.index(photo) + 1
|
32 |
photo = celeb_list[index]
|
@@ -37,7 +40,9 @@ def Clear(prev_size, photo=celeb_list[1], folder=celeb_folder, next=False):
|
|
37 |
|
38 |
for curr_size in pixel_sizes:
|
39 |
if curr_size<prev_size:
|
40 |
-
|
|
|
|
|
41 |
|
42 |
|
43 |
# # Display the pixelated images progressively
|
@@ -54,7 +59,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
54 |
gr.Markdown(MARKDOWN)
|
55 |
|
56 |
Old_size = curr_size
|
57 |
-
Actual_Answer =
|
58 |
if_next=True
|
59 |
|
60 |
with gr.Row():
|
@@ -63,10 +68,12 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
63 |
with gr.Accordion("Answer", open=False):
|
64 |
answer = gr.Textbox()
|
65 |
|
|
|
66 |
Clear_button = gr.Button(value='Clear', variant='primary')
|
67 |
Next_button = gr.Button(value='Next', variant='secondary')
|
68 |
|
69 |
-
|
70 |
-
|
|
|
71 |
|
72 |
demo.launch(debug=False, show_error=True)
|
|
|
27 |
|
28 |
curr_size = 256
|
29 |
def Clear(prev_size, photo=celeb_list[1], folder=celeb_folder, next=False):
|
30 |
+
global photo_answer
|
31 |
+
global curr_size
|
32 |
+
|
33 |
if next:
|
34 |
index = celeb_list.index(photo) + 1
|
35 |
photo = celeb_list[index]
|
|
|
40 |
|
41 |
for curr_size in pixel_sizes:
|
42 |
if curr_size<prev_size:
|
43 |
+
result_img = pixelate(img, curr_size)
|
44 |
+
photo_answer = photo
|
45 |
+
return result_img, photo
|
46 |
|
47 |
|
48 |
# # Display the pixelated images progressively
|
|
|
59 |
gr.Markdown(MARKDOWN)
|
60 |
|
61 |
Old_size = curr_size
|
62 |
+
Actual_Answer = photo_answer
|
63 |
if_next=True
|
64 |
|
65 |
with gr.Row():
|
|
|
68 |
with gr.Accordion("Answer", open=False):
|
69 |
answer = gr.Textbox()
|
70 |
|
71 |
+
Start_button = gr.Button(value='Start', variant='huggingface')
|
72 |
Clear_button = gr.Button(value='Clear', variant='primary')
|
73 |
Next_button = gr.Button(value='Next', variant='secondary')
|
74 |
|
75 |
+
Start_button.click(fn=Clear, inputs=[256], outputs=[pixelated_image, answer])
|
76 |
+
Clear_button.click(fn=Clear, inputs=[Old_size], outputs=[pixelated_image, answer])
|
77 |
+
Next_button.click(fn=Clear, inputs=[Old_size, Actual_Answer, if_next], outputs=[pixelated_image, answer])
|
78 |
|
79 |
demo.launch(debug=False, show_error=True)
|