Commit
·
34b7830
1
Parent(s):
c89edf9
Fix infinite
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
#!/usr/bin/env python
|
| 2 |
# coding: utf-8
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import random
|
| 5 |
import torch
|
|
@@ -81,8 +82,7 @@ with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
|
|
| 81 |
else:
|
| 82 |
others_value = ''
|
| 83 |
state["selected"] = selected_index
|
| 84 |
-
|
| 85 |
-
return [others] * 5 + [state]
|
| 86 |
|
| 87 |
def clear_seed(state):
|
| 88 |
"""Update state of Radio buttons, grid, seeded_box"""
|
|
@@ -166,7 +166,8 @@ with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
|
|
| 166 |
radio.change(
|
| 167 |
partial(update_state, i),
|
| 168 |
inputs=[radio, state],
|
| 169 |
-
outputs=others + [state]
|
|
|
|
| 170 |
)
|
| 171 |
|
| 172 |
with (seeded_box := gr.Box()):
|
|
|
|
| 1 |
#!/usr/bin/env python
|
| 2 |
# coding: utf-8
|
| 3 |
+
import queue
|
| 4 |
import gradio as gr
|
| 5 |
import random
|
| 6 |
import torch
|
|
|
|
| 82 |
else:
|
| 83 |
others_value = ''
|
| 84 |
state["selected"] = selected_index
|
| 85 |
+
return [gr.Radio.update(value=others_value) for _ in range(5)] + [state]
|
|
|
|
| 86 |
|
| 87 |
def clear_seed(state):
|
| 88 |
"""Update state of Radio buttons, grid, seeded_box"""
|
|
|
|
| 166 |
radio.change(
|
| 167 |
partial(update_state, i),
|
| 168 |
inputs=[radio, state],
|
| 169 |
+
outputs=others + [state],
|
| 170 |
+
queue=False
|
| 171 |
)
|
| 172 |
|
| 173 |
with (seeded_box := gr.Box()):
|