shichen commited on
Commit
ccfa5a6
1 Parent(s): 7257002

更新key申请

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -37,21 +37,23 @@ def generate_image(api_key, prompt, aspect_ratio, model, negative_prompt, seed):
37
  with gr.Blocks() as demo:
38
  with gr.Row():
39
  with gr.Column(scale=1):
 
40
  api_key = gr.Textbox(label="API Key")
41
  prompt = gr.Textbox(label="Prompt", placeholder="What you wish to see in the output image.")
42
  aspect_ratio = gr.Dropdown(label="Aspect Ratio", choices=["16:9", "1:1", "21:9", "2:3", "3:2", "4:5", "5:4", "9:16", "9:21"], value="1:1")
43
  model = gr.Dropdown(label="Model", choices=["sd3", "sd3-turbo"], value="sd3")
 
 
44
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Describe what you do not wish to see.")
45
- seed = gr.Number(label="Seed", value=0, minimum=0, maximum=4294967294, step=1)
46
  generate_btn = gr.Button("Generate Image")
47
- # api_key_info = gr.Text("API Key Application", style="bold") # Text display
48
- # api_key_link = gr.Link("https://platform.stability.ai/account/keys", "Apply Here") # Hyperlink
49
  with gr.Column(scale=1):
50
  output = gr.Image()
51
 
 
 
52
 
53
  generate_btn.click(fn=generate_image,
54
  inputs=[api_key, prompt, aspect_ratio, model, negative_prompt, seed],
55
  outputs=output)
56
 
57
- demo.launch()
 
37
  with gr.Blocks() as demo:
38
  with gr.Row():
39
  with gr.Column(scale=1):
40
+ api_key_text = gr.HTML("<a href='https://platform.stability.ai/account/keys' target='_blank'>点我申请API-key,免费运行6次</a>")
41
  api_key = gr.Textbox(label="API Key")
42
  prompt = gr.Textbox(label="Prompt", placeholder="What you wish to see in the output image.")
43
  aspect_ratio = gr.Dropdown(label="Aspect Ratio", choices=["16:9", "1:1", "21:9", "2:3", "3:2", "4:5", "5:4", "9:16", "9:21"], value="1:1")
44
  model = gr.Dropdown(label="Model", choices=["sd3", "sd3-turbo"], value="sd3")
45
+ seed = gr.Number(label="Seed (输入0则随机种子)", value=0, minimum=0, maximum=4294967294, step=1)
46
+ seed.description = "输入0则随机种子"
47
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Describe what you do not wish to see.")
 
48
  generate_btn = gr.Button("Generate Image")
 
 
49
  with gr.Column(scale=1):
50
  output = gr.Image()
51
 
52
+
53
+
54
 
55
  generate_btn.click(fn=generate_image,
56
  inputs=[api_key, prompt, aspect_ratio, model, negative_prompt, seed],
57
  outputs=output)
58
 
59
+ demo.launch(server_port=7855)