Spaces:
Runtime error
Runtime error
Here, replace Global with State
#1
by
radames
- opened
flood.py
CHANGED
|
@@ -93,20 +93,18 @@ def prime_the_thing():
|
|
| 93 |
timestr = bandaid.uuid4()
|
| 94 |
if not os.path.exists(f'./frames{timestr}'):
|
| 95 |
os.mkdir(f'./frames{timestr}')
|
| 96 |
-
|
| 97 |
-
global frame_file_box
|
| 98 |
-
global frame_tar_box
|
| 99 |
frame_box=[]
|
| 100 |
frame_file_box=[]
|
| 101 |
frame_tar_box=[]
|
| 102 |
go=1
|
| 103 |
-
return timestr, go
|
| 104 |
|
| 105 |
def go_fn():
|
| 106 |
num=1
|
| 107 |
return num
|
| 108 |
|
| 109 |
-
def the_thing(inputs,input_rand, model_choice,num,top_num,timestr):
|
| 110 |
if num != 0:
|
| 111 |
if int(num) <= int(top_num):
|
| 112 |
#proc1=
|
|
@@ -134,7 +132,7 @@ def the_thing(inputs,input_rand, model_choice,num,top_num,timestr):
|
|
| 134 |
|
| 135 |
else:
|
| 136 |
print("ending")
|
| 137 |
-
return frame_box,frame_file_box,frame_tar_box,num,input_rand
|
| 138 |
|
| 139 |
|
| 140 |
css=""""""
|
|
@@ -144,6 +142,9 @@ max-height:10vh;!important;
|
|
| 144 |
}
|
| 145 |
"""
|
| 146 |
with gr.Blocks(css=css) as myface:
|
|
|
|
|
|
|
|
|
|
| 147 |
with gr.Row():
|
| 148 |
with gr.Tab("Title"):
|
| 149 |
gr.HTML(""" <title>Diffusion Flood</title>
|
|
@@ -228,9 +229,9 @@ with gr.Blocks(css=css) as myface:
|
|
| 228 |
def short_prompt(inputs):
|
| 229 |
return(inputs)
|
| 230 |
|
| 231 |
-
run.click(prime_the_thing, inputs=[], outputs=[time_box,frame_num])
|
| 232 |
go_box.change(go_fn,inputs=[],outputs=[frame_num])
|
| 233 |
-
frame_num.change(the_thing, inputs=[magic_text,rand_box, model_name1, frame_num, frame_top,time_box], outputs=[frames,frame_files,frame_tar,frame_num,rand_box])
|
| 234 |
#use_short.click(short_prompt,inputs=[input_text],outputs=magic_text)
|
| 235 |
#see_prompt.click(text_it,inputs=[input_text],outputs=[magic_text])
|
| 236 |
#model_name1.change(set_model,inputs=model_name1,outputs=[output1,output2,output3,output4,output5,output6,output7,output8])
|
|
|
|
| 93 |
timestr = bandaid.uuid4()
|
| 94 |
if not os.path.exists(f'./frames{timestr}'):
|
| 95 |
os.mkdir(f'./frames{timestr}')
|
| 96 |
+
|
|
|
|
|
|
|
| 97 |
frame_box=[]
|
| 98 |
frame_file_box=[]
|
| 99 |
frame_tar_box=[]
|
| 100 |
go=1
|
| 101 |
+
return timestr, go, frame_box, frame_file_box, frame_tar_box
|
| 102 |
|
| 103 |
def go_fn():
|
| 104 |
num=1
|
| 105 |
return num
|
| 106 |
|
| 107 |
+
def the_thing(inputs,input_rand, model_choice,num,top_num,timestr, frame_box, frame_file_box, frame_tar_box):
|
| 108 |
if num != 0:
|
| 109 |
if int(num) <= int(top_num):
|
| 110 |
#proc1=
|
|
|
|
| 132 |
|
| 133 |
else:
|
| 134 |
print("ending")
|
| 135 |
+
return frame_box,frame_file_box,frame_tar_box,num,input_rand,frame_box,frame_file_box,frame_tar_box
|
| 136 |
|
| 137 |
|
| 138 |
css=""""""
|
|
|
|
| 142 |
}
|
| 143 |
"""
|
| 144 |
with gr.Blocks(css=css) as myface:
|
| 145 |
+
frame_box = gr.State([])
|
| 146 |
+
frame_file_box = gr.State([])
|
| 147 |
+
frame_tar_box = gr.State([])
|
| 148 |
with gr.Row():
|
| 149 |
with gr.Tab("Title"):
|
| 150 |
gr.HTML(""" <title>Diffusion Flood</title>
|
|
|
|
| 229 |
def short_prompt(inputs):
|
| 230 |
return(inputs)
|
| 231 |
|
| 232 |
+
run.click(prime_the_thing, inputs=[], outputs=[time_box,frame_num, frame_box, frame_file_box, frame_tar_box])
|
| 233 |
go_box.change(go_fn,inputs=[],outputs=[frame_num])
|
| 234 |
+
frame_num.change(the_thing, inputs=[magic_text,rand_box, model_name1, frame_num, frame_top,time_box, frame_box, frame_file_box, frame_tar_box], outputs=[frames,frame_files,frame_tar,frame_num,rand_box, frame_box, frame_file_box, frame_tar_box])
|
| 235 |
#use_short.click(short_prompt,inputs=[input_text],outputs=magic_text)
|
| 236 |
#see_prompt.click(text_it,inputs=[input_text],outputs=[magic_text])
|
| 237 |
#model_name1.change(set_model,inputs=model_name1,outputs=[output1,output2,output3,output4,output5,output6,output7,output8])
|