Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,7 +162,7 @@ opt.colors = [
|
|
| 162 |
# '#92C6EC',
|
| 163 |
# '#FECAC0',
|
| 164 |
]
|
| 165 |
-
opt.excluded_keys = ['inpainting_mode', 'is_running', 'active_palettes', 'current_palette', 'model']
|
| 166 |
opt.prep_time = -3
|
| 167 |
|
| 168 |
|
|
@@ -498,6 +498,7 @@ def run(state, drawpad):
|
|
| 498 |
|
| 499 |
state = register(state, drawpad, model)
|
| 500 |
state.is_running = True
|
|
|
|
| 501 |
|
| 502 |
tic = time.time()
|
| 503 |
while True:
|
|
@@ -513,13 +514,16 @@ def run(state, drawpad):
|
|
| 513 |
# mask_std=data['mask_stds'][i],
|
| 514 |
# )
|
| 515 |
|
| 516 |
-
|
|
|
|
|
|
|
|
|
|
| 517 |
toc = time.time()
|
| 518 |
tdelta = toc - tic
|
| 519 |
if tdelta > opt.run_time:
|
| 520 |
state.is_running = False
|
| 521 |
state.model = None
|
| 522 |
-
return [state,
|
| 523 |
|
| 524 |
|
| 525 |
def hide_element():
|
|
@@ -930,7 +934,6 @@ with gr.Blocks(theme=gr.themes.Soft(), css=css, head=head) as demo:
|
|
| 930 |
height='auto',
|
| 931 |
preview=True,
|
| 932 |
interactive=False,
|
| 933 |
-
visible=False,
|
| 934 |
)
|
| 935 |
iface.btn_share = gr.Button('🤗 Share with Community', elem_id='share-btn')
|
| 936 |
|
|
@@ -1150,7 +1153,7 @@ Deadline animation originally by <a href="https://codepen.io/jtrancozo/pen/mEoEV
|
|
| 1150 |
run_event.then(
|
| 1151 |
fn=run,
|
| 1152 |
inputs=[state, iface.ctrl_semantic],
|
| 1153 |
-
outputs=[state, iface.image_slot],
|
| 1154 |
api_name='run',
|
| 1155 |
).then(
|
| 1156 |
fn=hide_element,
|
|
|
|
| 162 |
# '#92C6EC',
|
| 163 |
# '#FECAC0',
|
| 164 |
]
|
| 165 |
+
opt.excluded_keys = ['inpainting_mode', 'is_running', 'active_palettes', 'current_palette', 'model', 'history']
|
| 166 |
opt.prep_time = -3
|
| 167 |
|
| 168 |
|
|
|
|
| 498 |
|
| 499 |
state = register(state, drawpad, model)
|
| 500 |
state.is_running = True
|
| 501 |
+
state.history = []
|
| 502 |
|
| 503 |
tic = time.time()
|
| 504 |
while True:
|
|
|
|
| 514 |
# mask_std=data['mask_stds'][i],
|
| 515 |
# )
|
| 516 |
|
| 517 |
+
image = model()
|
| 518 |
+
state.history.append(image)
|
| 519 |
+
|
| 520 |
+
yield [state, image, state.history]
|
| 521 |
toc = time.time()
|
| 522 |
tdelta = toc - tic
|
| 523 |
if tdelta > opt.run_time:
|
| 524 |
state.is_running = False
|
| 525 |
state.model = None
|
| 526 |
+
return [state, image, state.history]
|
| 527 |
|
| 528 |
|
| 529 |
def hide_element():
|
|
|
|
| 934 |
height='auto',
|
| 935 |
preview=True,
|
| 936 |
interactive=False,
|
|
|
|
| 937 |
)
|
| 938 |
iface.btn_share = gr.Button('🤗 Share with Community', elem_id='share-btn')
|
| 939 |
|
|
|
|
| 1153 |
run_event.then(
|
| 1154 |
fn=run,
|
| 1155 |
inputs=[state, iface.ctrl_semantic],
|
| 1156 |
+
outputs=[state, iface.image_slot, iface.history],
|
| 1157 |
api_name='run',
|
| 1158 |
).then(
|
| 1159 |
fn=hide_element,
|