Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,7 @@ 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
|
@@ -32,6 +33,16 @@ def get_params(request: gr.Request):
|
|
32 |
info = "default prompt: {}".format(DEFAULT_PROMPT)
|
33 |
)
|
34 |
#return list_models, get_samples()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
client = InferenceClient()
|
37 |
models = client.list_deployed_models()
|
@@ -234,8 +245,8 @@ with gr.Blocks(css=css) as demo:
|
|
234 |
|
235 |
with gr.Row(elem_id="prompt-container"):
|
236 |
with gr.Column():
|
237 |
-
btn_refresh = gr.Button(value="Click
|
238 |
-
btn_refresh.click(None, js="window.location.reload()")
|
239 |
current_model = gr.Dropdown(label="Current Model", choices=list_models, value=DEFAULT_MODEL,
|
240 |
info = "default model: {}".format(DEFAULT_MODEL)
|
241 |
)
|
@@ -272,6 +283,8 @@ with gr.Blocks(css=css) as demo:
|
|
272 |
|
273 |
text_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
|
274 |
select_button.click(generate_txt2img, inputs=[current_model, select_prompt, negative_prompt, image_style], outputs=image_output)
|
|
|
|
|
275 |
|
276 |
#demo.load(get_params, None, [current_model, select_prompt])
|
277 |
|
|
|
17 |
prompt_list = prompt_df.sample(n = 10)["Prompt"].map(lambda x: x).values.tolist()
|
18 |
return prompt_list
|
19 |
|
20 |
+
'''
|
21 |
def get_params(request: gr.Request):
|
22 |
params = request.query_params
|
23 |
ip = request.client.host
|
|
|
33 |
info = "default prompt: {}".format(DEFAULT_PROMPT)
|
34 |
)
|
35 |
#return list_models, get_samples()
|
36 |
+
'''
|
37 |
+
|
38 |
+
def update_models():
|
39 |
+
client = InferenceClient()
|
40 |
+
models = client.list_deployed_models()
|
41 |
+
list_models = models["text-to-image"]
|
42 |
+
return gr.Dropdown.update(choices=list_models)
|
43 |
+
|
44 |
+
def update_prompts():
|
45 |
+
return gr.Dropdown.update(choices=get_samples())
|
46 |
|
47 |
client = InferenceClient()
|
48 |
models = client.list_deployed_models()
|
|
|
245 |
|
246 |
with gr.Row(elem_id="prompt-container"):
|
247 |
with gr.Column():
|
248 |
+
btn_refresh = gr.Button(value="Click to get current deployed models and newly Prompt candidates")
|
249 |
+
#btn_refresh.click(None, js="window.location.reload()")
|
250 |
current_model = gr.Dropdown(label="Current Model", choices=list_models, value=DEFAULT_MODEL,
|
251 |
info = "default model: {}".format(DEFAULT_MODEL)
|
252 |
)
|
|
|
283 |
|
284 |
text_button.click(generate_txt2img, inputs=[current_model, text_prompt, negative_prompt, image_style], outputs=image_output)
|
285 |
select_button.click(generate_txt2img, inputs=[current_model, select_prompt, negative_prompt, image_style], outputs=image_output)
|
286 |
+
btn_refresh.click(update_models, None, current_model)
|
287 |
+
btn_refresh.click(update_prompts, None, select_prompt)
|
288 |
|
289 |
#demo.load(get_params, None, [current_model, select_prompt])
|
290 |
|