Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,15 @@ def get_samples():
|
|
17 |
prompt_list = prompt_df.sample(n = 10)["Prompt"].map(lambda x: x).values.tolist()
|
18 |
return prompt_list
|
19 |
|
|
|
|
|
|
|
20 |
def get_params(request: gr.Request):
|
21 |
params = request.query_params
|
22 |
ip = request.client.host
|
23 |
req = {"params": params,
|
24 |
"ip": ip}
|
25 |
-
return
|
26 |
|
27 |
list_models = [
|
28 |
"SDXL-1.0",
|
@@ -222,8 +225,9 @@ with gr.Blocks(css=css) as demo:
|
|
222 |
)
|
223 |
select_button = gr.Button("Select Prompt Generate", variant='primary', elem_id="gen-button")
|
224 |
with gr.Row("prompt-container"):
|
225 |
-
btn_refresh = gr.Button(value="Click
|
226 |
-
btn_refresh.click(None, js="window.location.reload()")
|
|
|
227 |
|
228 |
with gr.Row():
|
229 |
image_output = gr.Image(type="pil", label="Output Image", elem_id="gallery")
|
|
|
17 |
prompt_list = prompt_df.sample(n = 10)["Prompt"].map(lambda x: x).values.tolist()
|
18 |
return prompt_list
|
19 |
|
20 |
+
def update_prompts():
|
21 |
+
return gr.Dropdown.update(choices=get_samples())
|
22 |
+
|
23 |
def get_params(request: gr.Request):
|
24 |
params = request.query_params
|
25 |
ip = request.client.host
|
26 |
req = {"params": params,
|
27 |
"ip": ip}
|
28 |
+
return update_prompts()
|
29 |
|
30 |
list_models = [
|
31 |
"SDXL-1.0",
|
|
|
225 |
)
|
226 |
select_button = gr.Button("Select Prompt Generate", variant='primary', elem_id="gen-button")
|
227 |
with gr.Row("prompt-container"):
|
228 |
+
btn_refresh = gr.Button(value="Click to get newly Prompt candidates")
|
229 |
+
#btn_refresh.click(None, js="window.location.reload()")
|
230 |
+
btn_refresh.click(update_prompts, None, select_prompt)
|
231 |
|
232 |
with gr.Row():
|
233 |
image_output = gr.Image(type="pil", label="Output Image", elem_id="gallery")
|