Add example prompt buttons to Text to Image tab
Browse files- src/ui/tabs.py +41 -0
src/ui/tabs.py
CHANGED
|
@@ -156,6 +156,13 @@ def create_text_to_image_tab():
|
|
| 156 |
lines=3
|
| 157 |
)
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
format_type = gr.Dropdown(
|
| 160 |
label="Format",
|
| 161 |
choices=["image", "multi", "3d"],
|
|
@@ -183,6 +190,40 @@ def create_text_to_image_tab():
|
|
| 183 |
api_name=None
|
| 184 |
)
|
| 185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
return {
|
| 187 |
"prompt": prompt,
|
| 188 |
"format_type": format_type,
|
|
|
|
| 156 |
lines=3
|
| 157 |
)
|
| 158 |
|
| 159 |
+
# Example prompt buttons
|
| 160 |
+
with gr.Row():
|
| 161 |
+
example1_btn = gr.Button("Example 1", size="sm")
|
| 162 |
+
example2_btn = gr.Button("Example 2", size="sm")
|
| 163 |
+
example3_btn = gr.Button("Example 3", size="sm")
|
| 164 |
+
example4_btn = gr.Button("Example 4", size="sm")
|
| 165 |
+
|
| 166 |
format_type = gr.Dropdown(
|
| 167 |
label="Format",
|
| 168 |
choices=["image", "multi", "3d"],
|
|
|
|
| 190 |
api_name=None
|
| 191 |
)
|
| 192 |
|
| 193 |
+
# Example prompts
|
| 194 |
+
example_prompts = [
|
| 195 |
+
"An Adorable Alien Rambutan with large round eyes wearing acid-etched armor, in the style of a Pixar character design, soft studio lighting, highly detailed fur texture, whimsical expression, floating in a cosmic fruit bowl surrounded by stardust, 8k resolution, cinematic composition",
|
| 196 |
+
"panning photo of a red 1989 two-door Mercedes-Benz 450 SLC driving at high speed along a coastal highway, golden hour lighting, motion blur on wheels and background, sharp focus on car body, Mediterranean Sea visible in background, professional automotive photography",
|
| 197 |
+
"A high-contrast flash photograph captured on Fuji Superia X-Tra 400 film showing an elderly woman in a floral housedress washing a bright yellow Lamborghini Countach in her suburban driveway, garden hose in hand, curlers in hair, bemused expression, mundane meets extraordinary",
|
| 198 |
+
'{"subject": "great horned owl", "setting": "ancient library at midnight", "style": "Dutch Golden Age painting", "lighting": "single candle illumination with dramatic chiaroscuro", "details": "owl perched on stack of leather-bound books, spectacles on beak, quill pen nearby", "mood": "scholarly and mysterious", "technical": "oil painting texture, visible brushstrokes, museum quality"}'
|
| 199 |
+
]
|
| 200 |
+
|
| 201 |
+
# Wire up example buttons
|
| 202 |
+
example1_btn.click(
|
| 203 |
+
fn=lambda: example_prompts[0],
|
| 204 |
+
inputs=[],
|
| 205 |
+
outputs=[prompt],
|
| 206 |
+
api_name=None
|
| 207 |
+
)
|
| 208 |
+
example2_btn.click(
|
| 209 |
+
fn=lambda: example_prompts[1],
|
| 210 |
+
inputs=[],
|
| 211 |
+
outputs=[prompt],
|
| 212 |
+
api_name=None
|
| 213 |
+
)
|
| 214 |
+
example3_btn.click(
|
| 215 |
+
fn=lambda: example_prompts[2],
|
| 216 |
+
inputs=[],
|
| 217 |
+
outputs=[prompt],
|
| 218 |
+
api_name=None
|
| 219 |
+
)
|
| 220 |
+
example4_btn.click(
|
| 221 |
+
fn=lambda: example_prompts[3],
|
| 222 |
+
inputs=[],
|
| 223 |
+
outputs=[prompt],
|
| 224 |
+
api_name=None
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
return {
|
| 228 |
"prompt": prompt,
|
| 229 |
"format_type": format_type,
|