akhaliq HF staff commited on
Commit
042efb0
·
verified ·
1 Parent(s): 31dc3f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -6
app.py CHANGED
@@ -63,14 +63,34 @@ def generate_image(prompt, width, height, api_key):
63
  else:
64
  return f"Unexpected status: {status}"
65
 
66
- # Create Gradio interface
67
  iface = gr.Interface(
68
  fn=generate_image,
69
  inputs=[
70
- gr.Textbox(label="Prompt", placeholder="Describe the image you want to generate"),
71
- gr.Number(label="Width", value=512),
72
- gr.Number(label="Height", value=512),
73
- gr.Textbox(label="API Key", type="password", placeholder="Enter your BFL API key"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ],
75
  outputs="image",
76
  title="BFL Image Generation Demo",
@@ -79,12 +99,20 @@ iface = gr.Interface(
79
 
80
  **Instructions:**
81
  1. Enter a descriptive prompt for the image you want to generate.
82
- 2. Specify the width and height (in pixels) for the image.
83
  3. Enter your BFL API key. You can obtain one from [BFL API Portal](https://api.bfl.ml).
84
  4. Click "Submit" to generate the image.
85
 
86
  **Note:** Ensure you have sufficient credits and adhere to the API usage limits.
87
  """,
 
 
 
 
 
 
 
 
88
  )
89
 
90
  iface.launch()
 
63
  else:
64
  return f"Unexpected status: {status}"
65
 
66
+ # Create Gradio interface with sliders for width and height
67
  iface = gr.Interface(
68
  fn=generate_image,
69
  inputs=[
70
+ gr.Textbox(
71
+ label="Prompt",
72
+ placeholder="Describe the image you want to generate",
73
+ lines=3,
74
+ ),
75
+ gr.Slider(
76
+ label="Width",
77
+ minimum=256,
78
+ maximum=1440,
79
+ step=32,
80
+ value=1024,
81
+ ),
82
+ gr.Slider(
83
+ label="Height",
84
+ minimum=256,
85
+ maximum=1440,
86
+ step=32,
87
+ value=768,
88
+ ),
89
+ gr.Textbox(
90
+ label="API Key",
91
+ type="password",
92
+ placeholder="Enter your BFL API key",
93
+ ),
94
  ],
95
  outputs="image",
96
  title="BFL Image Generation Demo",
 
99
 
100
  **Instructions:**
101
  1. Enter a descriptive prompt for the image you want to generate.
102
+ 2. Use the sliders to specify the width and height (in pixels) for the image. Values must be multiples of 32.
103
  3. Enter your BFL API key. You can obtain one from [BFL API Portal](https://api.bfl.ml).
104
  4. Click "Submit" to generate the image.
105
 
106
  **Note:** Ensure you have sufficient credits and adhere to the API usage limits.
107
  """,
108
+ examples=[
109
+ [
110
+ "A cat on its back legs running like a human is holding a big silver fish with its arms. The cat is running away from the shop owner and has a panicked look on his face. The scene is situated in a crowded market.",
111
+ 1024,
112
+ 1024,
113
+ "",
114
+ ],
115
+ ],
116
  )
117
 
118
  iface.launch()