Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -55,40 +55,41 @@ with gr.Blocks(theme="NoCrypt/miku@>=1.2.2", fill_width=True, css="", delete_cac
|
|
55 |
recom_pony = gr.Textbox(label="Pony reccomended prompt", value="Pony", visible=False)
|
56 |
generate_image_btn = gr.Button(value="GENERATE IMAGE", size="lg", variant="primary")
|
57 |
result_image = gr.Gallery(label="Generated images", columns=1, object_fit="contain", container=True, preview=True, show_label=False, show_share_button=False, show_download_button=True, interactive=False, visible=True, format="png")
|
58 |
-
|
|
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
|
94 |
if __name__ == "__main__":
|
|
|
55 |
recom_pony = gr.Textbox(label="Pony reccomended prompt", value="Pony", visible=False)
|
56 |
generate_image_btn = gr.Button(value="GENERATE IMAGE", size="lg", variant="primary")
|
57 |
result_image = gr.Gallery(label="Generated images", columns=1, object_fit="contain", container=True, preview=True, show_label=False, show_share_button=False, show_download_button=True, interactive=False, visible=True, format="png")
|
58 |
+
gr.LoginButton()
|
59 |
+
gr.DuplicateButton(value="Duplicate Space for private use. (This demo does not work on CPU. Requires GPU Space.)")
|
60 |
|
61 |
+
gr.on(
|
62 |
+
triggers=[chat_msg.submit, chat_submit.click],
|
63 |
+
fn=dolphin_respond,
|
64 |
+
inputs=[chat_msg, chatbot, chat_model, chat_sysmsg, chat_tokens, chat_temperature, chat_topp, chat_topk, chat_rp],
|
65 |
+
outputs=[chatbot],
|
66 |
+
queue=True,
|
67 |
+
show_progress="full",
|
68 |
+
trigger_mode="once",
|
69 |
+
).success(dolphin_parse, [chatbot], [output_text, copy_btn, copy_btn_pony]).success(
|
70 |
+
convert_danbooru_to_e621_prompt, [output_text, tag_type], [output_text_pony], queue=False,
|
71 |
+
).success(insert_recom_prompt, [output_text, dummy_np, recom_animagine], [output_text, dummy_np], queue=False,
|
72 |
+
).success(insert_recom_prompt, [output_text_pony, dummy_np_pony, recom_pony], [output_text_pony, dummy_np_pony], queue=False)
|
73 |
+
chat_clear.click(lambda: None, None, chatbot, queue=False)
|
74 |
+
chat_model.change(select_dolphin_model, [chat_model], [chat_model, chat_format, chat_model_info], queue=True, show_progress="full")\
|
75 |
+
.success(lambda: None, None, chatbot, queue=False)
|
76 |
+
chat_format.change(select_dolphin_format, [chat_format], [chat_format], queue=False)\
|
77 |
+
.success(lambda: None, None, chatbot, queue=False)
|
78 |
+
chat_mode.change(select_dolphin_sysprompt, [chat_mode], [chat_sysmsg], queue=False)
|
79 |
+
chat_lang.change(select_dolphin_language, [chat_lang], [chat_sysmsg], queue=False)
|
80 |
+
gr.on(
|
81 |
+
triggers=[chat_add_text.submit, chat_add_submit.click],
|
82 |
+
fn=add_dolphin_models,
|
83 |
+
inputs=[chat_add_text, chat_add_format],
|
84 |
+
outputs=[chat_model],
|
85 |
+
queue=False,
|
86 |
+
trigger_mode="once",
|
87 |
+
)
|
88 |
|
89 |
+
copy_btn.click(gradio_copy_text, [output_text], js=COPY_ACTION_JS)
|
90 |
+
copy_btn_pony.click(gradio_copy_text, [output_text_pony], js=COPY_ACTION_JS)
|
91 |
|
92 |
+
generate_image_btn.click(generate_image, [output_text, dummy_np], [result_image], show_progress="full")
|
93 |
|
94 |
|
95 |
if __name__ == "__main__":
|