Update app.py
Browse files
app.py
CHANGED
|
@@ -11,12 +11,12 @@ def generate_artwork(description, style, enhance_details):
|
|
| 11 |
prompt += " with enhanced details"
|
| 12 |
|
| 13 |
# 根据用户选择的风格修改提示
|
| 14 |
-
if style == "
|
| 15 |
-
prompt += "
|
| 16 |
elif style == "Cyberpunk":
|
| 17 |
-
prompt += "
|
| 18 |
else:
|
| 19 |
-
prompt += "
|
| 20 |
|
| 21 |
# 生成图像
|
| 22 |
image = generate_image(prompt)
|
|
@@ -25,15 +25,15 @@ def generate_artwork(description, style, enhance_details):
|
|
| 25 |
# 创建 Gradio 界面
|
| 26 |
with gr.Blocks() as demo:
|
| 27 |
with gr.Row():
|
| 28 |
-
description_input = gr.Textbox(label="
|
| 29 |
-
style_selector = gr.Dropdown(choices=["
|
| 30 |
-
detail_checkbox = gr.Checkbox(label="
|
| 31 |
|
| 32 |
with gr.Row():
|
| 33 |
-
output_prompt = gr.Textbox(label="
|
| 34 |
-
output_image = gr.Image(label="
|
| 35 |
|
| 36 |
-
generate_button = gr.Button("
|
| 37 |
generate_button.click(generate_artwork,
|
| 38 |
inputs=[description_input, style_selector, detail_checkbox],
|
| 39 |
outputs=[output_prompt, output_image])
|
|
|
|
| 11 |
prompt += " with enhanced details"
|
| 12 |
|
| 13 |
# 根据用户选择的风格修改提示
|
| 14 |
+
if style == "梦幻":
|
| 15 |
+
prompt += "以奇幻风格"
|
| 16 |
elif style == "Cyberpunk":
|
| 17 |
+
prompt += "赛博朋克"
|
| 18 |
else:
|
| 19 |
+
prompt += "写实风格"
|
| 20 |
|
| 21 |
# 生成图像
|
| 22 |
image = generate_image(prompt)
|
|
|
|
| 25 |
# 创建 Gradio 界面
|
| 26 |
with gr.Blocks() as demo:
|
| 27 |
with gr.Row():
|
| 28 |
+
description_input = gr.Textbox(label="输入描述", placeholder="e.g., A magical treehouse in the sky")
|
| 29 |
+
style_selector = gr.Dropdown(choices=["梦幻", "赛博朋克", "写实"], label="选择风格")
|
| 30 |
+
detail_checkbox = gr.Checkbox(label="增强细节")
|
| 31 |
|
| 32 |
with gr.Row():
|
| 33 |
+
output_prompt = gr.Textbox(label="生成提示", interactive=False)
|
| 34 |
+
output_image = gr.Image(label="生成图像", interactive=False)
|
| 35 |
|
| 36 |
+
generate_button = gr.Button("生成作品")
|
| 37 |
generate_button.click(generate_artwork,
|
| 38 |
inputs=[description_input, style_selector, detail_checkbox],
|
| 39 |
outputs=[output_prompt, output_image])
|