Spaces:
Sleeping
Sleeping
File size: 2,151 Bytes
7981808 9cb47b2 7981808 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 9cb47b2 b35f032 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import gradio as gr
def generate_multi_model(input_img):
output_img = input_img
return output_img
def train_one_shot(title, context, img):
return f"Title:{title}\nContext:{context}\n...{img}"
def generate_one_shot(title, context, img):
return f"Title:{title}\nContext:{context}\n...{img}"
def train_zero_shot(title, context, img):
return f"Title:{title}\nContext:{context}\n...{img}"
def generate_zero_shot(title, context, img):
return f"Title:{title}\nContext:{context}\n...{img}"
with gr.Blocks() as demo:
# 顶部文字
gr.Markdown("# MMFS")
# 多个tab
with gr.Tabs():
with gr.TabItem("multi-model"):
multi_input_img = gr.Image(shape=(200, 200), label="请上传人像图片")
multi_model_button = gr.Button("随机风格化")
multi_output_img = gr.Image(shape=(200, 200), label="人像风格化图")
with gr.TabItem("one-shot"):
one_shot_src_img = gr.Image(shape=(200, 200), label="请上传内容图片")
one_shot_ref_img = gr.Image(shape=(200, 200), label="请上传风格图片")
one_shot_train_button = gr.Button("训练模型")
one_shot_test_button = gr.Button("风格化")
one_shot_output_img = gr.Image(shape=(200, 200), label="one-shot风格化图")
with gr.TabItem("zero-shot"):
zero_shot_src_img = gr.Image(shape=(200, 200), label="请上传内容图片")
zero_shot_ref_prompt = gr.Textbox(label="prompt", lines=1, placeholder="请输入参考风格描述(英文)")
zero_shot_train_button = gr.Button("训练模型")
zero_shot_test_button = gr.Button("风格化")
zero_shot_output_img = gr.Image(shape=(200, 200), label="zero-shot风格化图")
multi_model_button.click(fn=generate_multi_model, inputs=multi_input_img, outputs=multi_output_img)
one_shot_test_button.click(fn=generate_one_shot, inputs=[title,context,img], outputs=img_output)
zero_shot_test_button.click(fn=generate_zero_shot, inputs=[title,context,img], outputs=img_output)
demo.launch()
|