Spaces:
aiqcamp
/
Running on Zero

aiqcamp commited on
Commit
f1f3239
·
verified ·
1 Parent(s): e6dd635

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -73
app.py CHANGED
@@ -310,7 +310,7 @@ with gr.Blocks(css=css) as demo:
310
  with gr.Row(equal_height=True) as main_row:
311
  # 왼쪽 입력 컬럼
312
  with gr.Column(elem_id="input-column", scale=1):
313
- with gr.Group(elem_classes="input-box"): # Box를 Group으로 변경
314
  prompt = gr.Text(
315
  label="Diagram Prompt",
316
  placeholder="Enter your diagram structure...",
@@ -357,81 +357,23 @@ with gr.Blocks(css=css) as demo:
357
  with gr.Column(elem_id="examples-column", scale=1):
358
  gr.Markdown("### Example Diagrams")
359
  for example in EXAMPLES:
360
- with gr.Group(elem_classes="example-card"): # Box를 Group으로 변경
361
  gr.Markdown(f"#### {example['title']}")
362
  gr.Markdown(f"```\n{example['prompt']}\n```")
363
- if gr.Button("Use This Example", size="sm"):
364
- prompt.update(value=example['prompt'])
365
- width.update(value=example['width'])
366
- height.update(value=example['height'])# Gradio 인터페이스 수정
367
- with gr.Blocks(css=css) as demo:
368
- gr.Markdown(
369
- """
370
- <div class="title">FLUX Diagram Generator</div>
371
- <div class="subtitle">Create beautiful hand-drawn style diagrams using FLUX AI</div>
372
- """)
373
-
374
- gr.HTML("""<a href="https://visitorbadge.io/status?path=https%3A%2F%2Faiqcamp-diagram.hf.space">
375
- <img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Faiqcamp-diagram.hf.space&countColor=%23263759" />
376
- </a>""")
377
-
378
- with gr.Row(equal_height=True) as main_row:
379
- # 왼쪽 입력 컬럼
380
- with gr.Column(elem_id="input-column", scale=1):
381
- with gr.Group(elem_classes="input-box"): # Box를 Group으로 변경
382
- prompt = gr.Text(
383
- label="Diagram Prompt",
384
- placeholder="Enter your diagram structure...",
385
- lines=5
386
- )
387
- run_button = gr.Button("Generate Diagram", variant="primary")
388
- result = gr.Image(label="Generated Diagram")
389
-
390
- with gr.Accordion("Advanced Settings", open=False):
391
- seed = gr.Slider(
392
- label="Seed",
393
- minimum=0,
394
- maximum=MAX_SEED,
395
- step=1,
396
- value=0,
397
- )
398
- randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
399
-
400
- with gr.Row():
401
- width = gr.Slider(
402
- label="Width",
403
- minimum=256,
404
- maximum=MAX_IMAGE_SIZE,
405
- step=32,
406
- value=1024,
407
- )
408
- height = gr.Slider(
409
- label="Height",
410
- minimum=256,
411
- maximum=MAX_IMAGE_SIZE,
412
- step=32,
413
- value=1024,
414
  )
415
-
416
- num_inference_steps = gr.Slider(
417
- label="Number of inference steps",
418
- minimum=1,
419
- maximum=50,
420
- step=1,
421
- value=4,
422
- )
423
-
424
- # 오른쪽 예제 컬럼
425
- with gr.Column(elem_id="examples-column", scale=1):
426
- gr.Markdown("### Example Diagrams")
427
- for example in EXAMPLES:
428
- with gr.Group(elem_classes="example-card"): # Box를 Group으로 변경
429
- gr.Markdown(f"#### {example['title']}")
430
- gr.Markdown(f"```\n{example['prompt']}\n```")
431
- if gr.Button("Use This Example", size="sm"):
432
- prompt.update(value=example['prompt'])
433
- width.update(value=example['width'])
434
- height.update(value=example['height'])
435
 
436
  gr.on(
437
  triggers=[run_button.click, prompt.submit],
 
310
  with gr.Row(equal_height=True) as main_row:
311
  # 왼쪽 입력 컬럼
312
  with gr.Column(elem_id="input-column", scale=1):
313
+ with gr.Group(elem_classes="input-box"):
314
  prompt = gr.Text(
315
  label="Diagram Prompt",
316
  placeholder="Enter your diagram structure...",
 
357
  with gr.Column(elem_id="examples-column", scale=1):
358
  gr.Markdown("### Example Diagrams")
359
  for example in EXAMPLES:
360
+ with gr.Group(elem_classes="example-card"):
361
  gr.Markdown(f"#### {example['title']}")
362
  gr.Markdown(f"```\n{example['prompt']}\n```")
363
+
364
+ def create_example_handler(ex):
365
+ def handler():
366
+ return {
367
+ prompt: ex["prompt"],
368
+ width: ex["width"],
369
+ height: ex["height"]
370
+ }
371
+ return handler
372
+
373
+ gr.Button("Use This Example", size="sm").click(
374
+ fn=create_example_handler(example),
375
+ outputs=[prompt, width, height]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
 
378
  gr.on(
379
  triggers=[run_button.click, prompt.submit],