weijiang2024 commited on
Commit
426fe86
·
verified ·
1 Parent(s): 44a6254

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +6 -5
README.md CHANGED
@@ -21,7 +21,7 @@ sdk_version: 4.29.0
21
  * 人工审阅及智能投放
22
 
23
  ## 技术路线
24
- * 使用 python gradio lib 进行AI应用构建
25
 
26
  ## How to Deploy
27
  * gradio deploy
 
21
  * 人工审阅及智能投放
22
 
23
  ## 技术路线
24
+ * USE python gradio as the interface for the AI application
25
 
26
  ## How to Deploy
27
  * gradio deploy
app.py CHANGED
@@ -43,7 +43,7 @@ def send_generation_request(
43
 
44
  return response
45
 
46
- def generate_image(prompt, negative_prompt, aspect_ratio, seed, output_format):
47
  """Generates an image using the SD3 API."""
48
 
49
  host = os.environ["STABILITY_HOST"]
@@ -54,7 +54,7 @@ def generate_image(prompt, negative_prompt, aspect_ratio, seed, output_format):
54
  "aspect_ratio": aspect_ratio,
55
  "seed": seed,
56
  "output_format": output_format,
57
- "model": "sd3-medium", # You can change the model here
58
  "mode": "text-to-image"
59
  }
60
 
@@ -87,9 +87,10 @@ interface = gr.Interface(
87
  inputs=[
88
  gr.Textbox(label="正向提示词", placeholder="This dreamlike digital art captures a vibrant, kaleidoscopic bird in a lush rainforest"),
89
  gr.Textbox(label="负向提示词", placeholder="Optional"),
90
- gr.Dropdown(label="长宽比", choices=["21:9", "16:9", "3:2", "5:4", "1:1", "4:5", "2:3", "9:16", "9:21"], value="16:9"),
91
  gr.Number(label="生成算法随机种子", value=0),
92
- gr.Dropdown(label="输出格式", choices=["jpeg", "png"], value="png")
 
 
93
  ],
94
  outputs="image",
95
  title="Stable Diffusion 3 Image Generator",
@@ -97,4 +98,4 @@ interface = gr.Interface(
97
  )
98
 
99
  # Launch the interface
100
- interface.launch(share=True)
 
43
 
44
  return response
45
 
46
+ def generate_image(prompt, negative_prompt, aspect_ratio, seed, output_format, model):
47
  """Generates an image using the SD3 API."""
48
 
49
  host = os.environ["STABILITY_HOST"]
 
54
  "aspect_ratio": aspect_ratio,
55
  "seed": seed,
56
  "output_format": output_format,
57
+ "model": model, # Use the selected model
58
  "mode": "text-to-image"
59
  }
60
 
 
87
  inputs=[
88
  gr.Textbox(label="正向提示词", placeholder="This dreamlike digital art captures a vibrant, kaleidoscopic bird in a lush rainforest"),
89
  gr.Textbox(label="负向提示词", placeholder="Optional"),
 
90
  gr.Number(label="生成算法随机种子", value=0),
91
+ gr.Dropdown(label="长宽比", choices=["21:9", "16:9", "3:2", "5:4", "1:1", "4:5", "2:3", "9:16", "9:21"], value="16:9"),
92
+ gr.Dropdown(label="输出格式", choices=["jpeg", "png"], value="png"),
93
+ gr.Dropdown(label="模型选择", choices=["sd3-large", "sd3-large-turbo", "sd3-medium"], value="sd3-medium") # Add model dropdown
94
  ],
95
  outputs="image",
96
  title="Stable Diffusion 3 Image Generator",
 
98
  )
99
 
100
  # Launch the interface
101
+ interface.launch(share=False)