txh17 commited on
Commit
c103200
·
verified ·
1 Parent(s): d5177f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -11,12 +11,12 @@ def generate_artwork(description, style, enhance_details):
11
  prompt += " with enhanced details"
12
 
13
  # 根据用户选择的风格修改提示
14
- if style == "Fantasy":
15
- prompt += " in a fantasy style"
16
  elif style == "Cyberpunk":
17
- prompt += " in a cyberpunk style"
18
  else:
19
- prompt += " in a realistic style"
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="Enter a description", placeholder="e.g., A magical treehouse in the sky")
29
- style_selector = gr.Dropdown(choices=["Fantasy", "Cyberpunk", "Realistic"], label="Select Style")
30
- detail_checkbox = gr.Checkbox(label="Enhance Details")
31
 
32
  with gr.Row():
33
- output_prompt = gr.Textbox(label="Generated Prompt", interactive=False)
34
- output_image = gr.Image(label="Generated Image", interactive=False)
35
 
36
- generate_button = gr.Button("Generate Artwork")
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])