aiqcamp commited on
Commit
ff24b8f
ยท
verified ยท
1 Parent(s): 95d0883

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -291
app.py CHANGED
@@ -448,296 +448,5 @@ with gr.Blocks(title="ํ‚ค์›Œ๋“œ ๊ธฐ๋ฐ˜ ์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด ์ƒ์„ฑ๊ธฐ",
448
  outputs=processing_indicator
449
  )
450
 
451
- if __name__ == "__main__":
452
- demo.launch(debug=True)
453
-
454
- ],
455
-
456
- "ํ™˜๊ฒฝ ์ƒํ˜ธ์ž‘์šฉ": [
457
- "์˜จ๋„ ๋ฐ˜์‘", "์Šต๋„ ๋ฐ˜์‘", "๊ธฐ์•• ๋ฐ˜์‘", "์ค‘๋ ฅ ๋ฐ˜์‘", "์ž๊ธฐ์žฅ ๋ฐ˜์‘",
458
- "๋น› ๋ฐ˜์‘", "์†Œ๋ฆฌ ๋ฐ˜์‘", "ํ™”ํ•™ ๋ฌผ์งˆ ๊ฐ์ง€", "๊ธฐ๊ณ„์  ์ž๊ทน ๊ฐ์ง€", "์ „๊ธฐ ์ž๊ทน ๋ฐ˜์‘",
459
- "๋ฐฉ์‚ฌ์„  ๋ฐ˜์‘", "์ง„๋™ ๊ฐ์ง€", "pH ๋ฐ˜์‘", "์šฉ๋งค ๋ฐ˜์‘", "๊ธฐ์ฒด ๊ตํ™˜",
460
- "ํ™˜๊ฒฝ ์˜ค์—ผ ๋ฐ˜์‘", "๋‚ ์”จ ๋ฐ˜์‘", "๊ณ„์ ˆ ๋ณ€ํ™” ๋ฐ˜์‘", "์ผ์ฃผ๊ธฐ ๋ฐ˜์‘", "์ƒํƒœ๊ณ„ ์ƒํ˜ธ์ž‘์šฉ",
461
- "๊ณต์ƒ/๊ฒฝ์Ÿ ๋ฐ˜์‘", "ํฌ์‹/ํ”ผ์‹ ๊ด€๊ณ„", "๊ตฐ์ง‘ ํ˜•์„ฑ", "์˜์—ญ ์„ค์ •", "์ด์ฃผ/์ •์ฐฉ ํŒจํ„ด"
462
- ],
463
-
464
- "์„ผ์„œ ๊ธฐ๋Šฅ": [
465
- "์‹œ๊ฐ ์„ผ์„œ/๊ฐ์ง€", "์ฒญ๊ฐ ์„ผ์„œ/๊ฐ์ง€", "์ด‰๊ฐ ์„ผ์„œ/๊ฐ์ง€", "๋ฏธ๊ฐ ์„ผ์„œ/๊ฐ์ง€", "ํ›„๊ฐ ์„ผ์„œ/๊ฐ์ง€",
466
- "์˜จ๋„ ์„ผ์„œ/๊ฐ์ง€", "์Šต๋„ ์„ผ์„œ/๊ฐ์ง€", "์••๋ ฅ ์„ผ์„œ/๊ฐ์ง€", "๊ฐ€์†๋„ ์„ผ์„œ/๊ฐ์ง€", "ํšŒ์ „ ์„ผ์„œ/๊ฐ์ง€",
467
- "๊ทผ์ ‘ ์„ผ์„œ/๊ฐ์ง€", "์œ„์น˜ ์„ผ์„œ/๊ฐ์ง€", "์šด๋™ ์„ผ์„œ/๊ฐ์ง€", "๊ฐ€์Šค ์„ผ์„œ/๊ฐ์ง€", "์ ์™ธ์„  ์„ผ์„œ/๊ฐ์ง€",
468
- "์ž์™ธ์„  ์„ผ์„œ/๊ฐ์ง€", "๋ฐฉ์‚ฌ์„  ์„ผ์„œ/๊ฐ์ง€", "์ž๊ธฐ์žฅ ์„ผ์„œ/๊ฐ์ง€", "์ „๊ธฐ์žฅ ์„ผ์„œ/๊ฐ์ง€", "ํ™”ํ•™๋ฌผ์งˆ ์„ผ์„œ/๊ฐ์ง€",
469
- "์ƒ์ฒด์‹ ํ˜ธ ์„ผ์„œ/๊ฐ์ง€", "์ง„๋™ ์„ผ์„œ/๊ฐ์ง€", "์†Œ์Œ ์„ผ์„œ/๊ฐ์ง€", "๋น› ์„ธ๊ธฐ ์„ผ์„œ/๊ฐ์ง€", "๋น› ํŒŒ์žฅ ์„ผ์„œ/๊ฐ์ง€",
470
- "๊ธฐ์šธ๊ธฐ ์„ผ์„œ/๊ฐ์ง€", "pH ์„ผ์„œ/๊ฐ์ง€", "์ „๋ฅ˜ ์„ผ์„œ/๊ฐ์ง€", "์ „์•• ์„ผ์„œ/๊ฐ์ง€", "์ด๋ฏธ์ง€ ์„ผ์„œ/๊ฐ์ง€",
471
- "๊ฑฐ๋ฆฌ ์„ผ์„œ/๊ฐ์ง€", "๊นŠ์ด ์„ผ์„œ/๊ฐ์ง€", "์ค‘๋ ฅ ์„ผ์„œ/๊ฐ์ง€", "์†๋„ ์„ผ์„œ/๊ฐ์ง€", "ํ๋ฆ„ ์„ผ์„œ/๊ฐ์ง€",
472
- "์ˆ˜์œ„ ์„ผ์„œ/๊ฐ์ง€", "ํƒ๋„ ์„ผ์„œ/๊ฐ์ง€", "์—ผ๋„ ์„ผ์„œ/๊ฐ์ง€", "๊ธˆ์† ๊ฐ์ง€", "์••์ „ ์„ผ์„œ/๊ฐ์ง€",
473
- "๊ด‘์ „ ์„ผ์„œ/๊ฐ์ง€", "์—ด์ „๋Œ€ ์„ผ์„œ/๊ฐ์ง€", "ํ™€ ํšจ๊ณผ ์„ผ์„œ/๊ฐ์ง€", "์ดˆ์ŒํŒŒ ์„ผ์„œ/๊ฐ์ง€", "๋ ˆ์ด๋” ์„ผ์„œ/๊ฐ์ง€",
474
- "๋ผ์ด๋‹ค ์„ผ์„œ/๊ฐ์ง€", "ํ„ฐ์น˜ ์„ผ์„œ/๊ฐ์ง€", "์ œ์Šค์ฒ˜ ์„ผ์„œ/๊ฐ์ง€", "์‹ฌ๋ฐ• ์„ผ์„œ/๊ฐ์ง€", "ํ˜ˆ์•• ์„ผ์„œ/๊ฐ์ง€"
475
- ]
476
- }
477
-
478
- ##############################################################################
479
- # Gemini API ํ˜ธ์ถœ ํ•จ์ˆ˜ (์˜ˆ: gemini-2.0-flash-thinking-exp-01-21 -> ๋‹ค๋ฅธ ๋ชจ๋ธ ์‚ฌ์šฉ ์‹œ ์ˆ˜์ •)
480
- ##############################################################################
481
- def query_gemini_api(prompt):
482
- try:
483
- # ์˜ˆ์‹œ: ๊ธฐ์กด gemini-2.0... ๋Œ€์‹ , ๋‹ค๋ฅธ ๋ชจ๋ธ์ด ํ•„์š”ํ•˜๋‹ค๋ฉด ๊ต์ฒดํ•˜์„ธ์š”.
484
- model = genai.GenerativeModel('gemini-2.0-flash-thinking-exp-01-21')
485
-
486
- response = model.generate_content(prompt)
487
-
488
- # ์‘๋‹ต ๊ตฌ์กฐ ๋ฐฉ์–ด์ ์œผ๋กœ ์ฒ˜๋ฆฌ
489
- try:
490
- if hasattr(response, 'text'):
491
- return response.text
492
-
493
- if hasattr(response, 'candidates') and response.candidates:
494
- if len(response.candidates) > 0:
495
- candidate = response.candidates[0]
496
- if hasattr(candidate, 'content'):
497
- content = candidate.content
498
- if hasattr(content, 'parts') and content.parts:
499
- if len(content.parts) > 0:
500
- return content.parts[0].text
501
- if hasattr(response, 'parts') and response.parts:
502
- if len(response.parts) > 0:
503
- return response.parts[0].text
504
-
505
- return "Unable to generate a response. API response structure is different than expected."
506
-
507
- except Exception as inner_e:
508
- logger.error(f"Error processing response: {inner_e}")
509
- return f"An error occurred while processing the response: {str(inner_e)}"
510
-
511
- except Exception as e:
512
- logger.error(f"Error calling Gemini API: {e}")
513
- if "API key not valid" in str(e):
514
- return "API key is not valid. Please check your GEMINI_API_KEY environment variable."
515
- return f"An error occurred while calling the API: {str(e)}"
516
-
517
- ##############################################################################
518
- # ์„ค๋ช… ํ™•์žฅ ํ•จ์ˆ˜: "๋ชจ๋ธ/์ปจ์…‰/ํ˜•์ƒ์˜ ๋ณ€ํ™”์— ๋Œ€ํ•œ ์ดํ•ด์™€ ํ˜์‹  ํฌ์ธํŠธ, ๊ธฐ๋Šฅ์„ฑ ๋“ฑ์„ ์ค‘์‹ฌ"์œผ๋กœ
519
- ##############################################################################
520
- def enhance_with_llm(base_description, obj_name, category):
521
- prompt = f"""
522
- ๋‹ค์Œ์€ '{obj_name}'์˜ '{category}' ๊ด€๋ จ ๊ฐ„๋‹จํ•œ ์„ค๋ช…์ž…๋‹ˆ๋‹ค:
523
- "{base_description}"
524
- ์œ„ ๋‚ด์šฉ์„ ๋ณด๋‹ค ๊ตฌ์ฒดํ™”ํ•˜์—ฌ,
525
- 1) ์ฐฝ์˜์ ์ธ ๋ชจ๋ธ/์ปจ์…‰/ํ˜•์ƒ์˜ ๋ณ€ํ™”์— ๋Œ€ํ•œ ์ดํ•ด,
526
- 2) ํ˜์‹  ํฌ์ธํŠธ์™€ ๊ธฐ๋Šฅ์„ฑ ๋“ฑ์„ ์ค‘์‹ฌ์œผ๋กœ
527
- 3~4๋ฌธ์žฅ์˜ ์•„์ด๋””์–ด๋กœ ํ™•์žฅํ•ด ์ฃผ์„ธ์š”.
528
- """
529
- return query_gemini_api(prompt)
530
-
531
- ##############################################################################
532
- # ๋‹จ์ผ ํ‚ค์›Œ๋“œ(์˜ค๋ธŒ์ ํŠธ)์— ๋Œ€ํ•œ "์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด" ์ƒ์„ฑ
533
- ##############################################################################
534
- def generate_single_object_transformations(obj):
535
- results = {}
536
- for category, transformations in physical_transformation_categories.items():
537
- transformation = choose_alternative(random.choice(transformations))
538
- base_description = f"{obj}์ด(๊ฐ€) {transformation} ํ˜„์ƒ์„ ๋ณด์ธ๋‹ค"
539
- results[category] = {"base": base_description, "enhanced": None}
540
- return results
541
-
542
- ##############################################################################
543
- # ๋‘ ํ‚ค์›Œ๋“œ์— ๋Œ€ํ•œ "์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด" ์ƒ์„ฑ
544
- ##############################################################################
545
- def generate_two_objects_interaction(obj1, obj2):
546
- results = {}
547
- for category, transformations in physical_transformation_categories.items():
548
- transformation = choose_alternative(random.choice(transformations))
549
- template = random.choice([
550
- "{obj1}์ด(๊ฐ€) {obj2}์— ๊ฒฐํ•ฉํ•˜์—ฌ {change}๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค",
551
- "{obj1}๊ณผ(์™€) {obj2}์ด(๊ฐ€) ์ถฉ๋Œํ•˜๋ฉด์„œ {change}๊ฐ€ ์ผ์–ด๋‚ฌ๋‹ค"
552
- ])
553
- base_description = template.format(obj1=obj1, obj2=obj2, change=transformation)
554
- results[category] = {"base": base_description, "enhanced": None}
555
- return results
556
-
557
- ##############################################################################
558
- # ์„ธ ํ‚ค์›Œ๋“œ์— ๋Œ€ํ•œ "์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด" ์ƒ์„ฑ
559
- ##############################################################################
560
- def generate_three_objects_interaction(obj1, obj2, obj3):
561
- results = {}
562
- for category, transformations in physical_transformation_categories.items():
563
- transformation = choose_alternative(random.choice(transformations))
564
- template = random.choice([
565
- "{obj1}, {obj2}, {obj3}์ด(๊ฐ€) ์‚ผ๊ฐํ˜• ๊ตฌ์กฐ๋กœ ๊ฒฐํ•ฉํ•˜์—ฌ {change}๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค",
566
- "{obj1}์ด(๊ฐ€) {obj2}์™€(๊ณผ) {obj3} ์‚ฌ์ด์—์„œ ๋งค๊ฐœ์ฒด ์—ญํ• ์„ ํ•˜๋ฉฐ {change}๋ฅผ ์ด‰์ง„ํ–ˆ๋‹ค"
567
- ])
568
- base_description = template.format(obj1=obj1, obj2=obj2, obj3=obj3, change=transformation)
569
- results[category] = {"base": base_description, "enhanced": None}
570
- return results
571
-
572
- ##############################################################################
573
- # ์ƒ์„ฑ๋œ ๊ธฐ๋ณธ ์„ค๋ช…์„ LLM์„ ํ†ตํ•ด ํ™•์žฅ
574
- ##############################################################################
575
- def enhance_descriptions(results, objects):
576
- obj_name = " ๋ฐ ".join([obj for obj in objects if obj])
577
-
578
- for category, result in results.items():
579
- result["enhanced"] = enhance_with_llm(result["base"], obj_name, category)
580
-
581
- return results
582
-
583
- ##############################################################################
584
- # ์‚ฌ์šฉ์ž ์ž…๋ ฅ(์ตœ๋Œ€ 3๊ฐœ ํ‚ค์›Œ๋“œ)์— ๋”ฐ๋ผ ์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด ์ƒ์„ฑ
585
- ##############################################################################
586
- def generate_transformations(text1, text2=None, text3=None):
587
- if text2 and text3:
588
- results = generate_three_objects_interaction(text1, text2, text3)
589
- objects = [text1, text2, text3]
590
- elif text2:
591
- results = generate_two_objects_interaction(text1, text2)
592
- objects = [text1, text2]
593
- else:
594
- results = generate_single_object_transformations(text1)
595
- objects = [text1]
596
-
597
- return enhance_descriptions(results, objects)
598
-
599
- ##############################################################################
600
- # ๊ฒฐ๊ณผ ํฌ๋งทํŒ…
601
- ##############################################################################
602
- def format_results(results):
603
- formatted = ""
604
- for category, result in results.items():
605
- formatted += f"## {category}\n**๊ธฐ๋ณธ ์•„์ด๋””์–ด**: {result['base']}\n\n**ํ™•์žฅ๋œ ์•„์ด๋””์–ด**: {result['enhanced']}\n\n---\n\n"
606
- return formatted
607
-
608
- ##############################################################################
609
- # Gradio UI์—์„œ ํ˜ธ์ถœํ•  ํ•จ์ˆ˜
610
- ##############################################################################
611
- def process_inputs(text1, text2, text3, selected_category, progress=gr.Progress()):
612
- text1 = text1.strip() if text1 else None
613
- text2 = text2.strip() if text2 else None
614
- text3 = text3.strip() if text3 else None
615
-
616
- if not text1:
617
- return "์˜ค๋ฅ˜: ์ตœ์†Œ ํ•˜๋‚˜์˜ ํ‚ค์›Œ๋“œ๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
618
-
619
- keyword_info = f"ํ‚ค์›Œ๋“œ: {text1}"
620
- if text2:
621
- keyword_info += f", {text2}"
622
- if text3:
623
- keyword_info += f", {text3}"
624
-
625
- progress(0.05, desc="์•„์ด๋””์–ด ์ƒ์„ฑ ์ค€๋น„ ์ค‘...")
626
- time.sleep(0.3) # ์‹œ๊ฐ์  ํšจ๊ณผ๋ฅผ ์œ„ํ•œ ์งง์€ ์ง€์—ฐ
627
-
628
- progress(0.1, desc="์ฐฝ์˜์ ์ธ ๋ชจ๋ธ/์ปจ์…‰/ํ˜•์ƒ ๋ณ€ํ™” ์•„์ด๋””์–ด ์ƒ์„ฑ ์‹œ์ž‘...")
629
-
630
- results = generate_transformations(text1, text2, text3)
631
-
632
- # ์„ ํƒํ•œ ์นดํ…Œ๊ณ ๋ฆฌ์— ํ•ด๋‹นํ•˜๋Š” ๊ฒฐ๊ณผ๋งŒ ํ•„ํ„ฐ๋ง
633
- if selected_category in results:
634
- results = {selected_category: results[selected_category]}
635
- else:
636
- return "์„ ํƒํ•œ ์นดํ…Œ๊ณ ๋ฆฌ๊ฐ€ ๊ฒฐ๊ณผ์— ์กด์žฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."
637
-
638
- progress(0.8, desc="๊ฒฐ๊ณผ ํฌ๋งทํŒ… ์ค‘...")
639
- formatted = format_results(results)
640
-
641
- progress(1.0, desc="์™„๋ฃŒ!")
642
- return formatted
643
-
644
- ##############################################################################
645
- # API ํ‚ค ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€
646
- ##############################################################################
647
- def get_warning_message():
648
- if not GEMINI_API_KEY:
649
- return "โš ๏ธ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ GEMINI_API_KEY๊ฐ€ ์„ค์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. Gemini API ํ‚ค๋ฅผ ์„ค์ •ํ•˜์„ธ์š”."
650
- return ""
651
-
652
- ##############################################################################
653
- # Gradio UI
654
- ##############################################################################
655
- with gr.Blocks(title="ํ‚ค์›Œ๋“œ ๊ธฐ๋ฐ˜ ์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด ์ƒ์„ฑ๊ธฐ",
656
- theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")) as demo:
657
-
658
- gr.HTML("""
659
- <style>
660
- body { background: linear-gradient(135deg, #e0eafc, #cfdef3); font-family: 'Arial', sans-serif; }
661
- .gradio-container { padding: 20px; }
662
- h1, h2 { text-align: center; }
663
- h1 { color: #333; }
664
- h2 { color: #555; }
665
- .output { background-color: #ffffff; padding: 15px; border-radius: 8px; }
666
- .gr-button { background-color: #4CAF50; color: white; border: none; border-radius: 4px; padding: 8px 16px; }
667
- .progress-message { color: #2196F3; font-weight: bold; margin-top: 10px; }
668
- </style>
669
- """)
670
-
671
- gr.Markdown("# ๐Ÿš€ ํ‚ค์›Œ๋“œ ๊ธฐ๋ฐ˜ ์ฐฝ์˜์  ๋ณ€ํ™” ์•„์ด๋””์–ด ์ƒ์„ฑ๊ธฐ")
672
- gr.Markdown("์ž…๋ ฅํ•œ **ํ‚ค์›Œ๋“œ**(์ตœ๋Œ€ 3๊ฐœ)์™€ **์นดํ…Œ๊ณ ๋ฆฌ**๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ, **์ฐฝ์˜์ ์ธ ๋ชจ๋ธ/์ปจ์…‰/ํ˜•์ƒ ๋ณ€ํ™”**์— ๋Œ€ํ•œ ์ดํ•ด์™€ **ํ˜์‹  ํฌ์ธํŠธ**, **๊ธฐ๋Šฅ์„ฑ** ๋“ฑ์„ ์ค‘์‹ฌ์œผ๋กœ ํ™•์žฅ๋œ ์•„์ด๋””์–ด๋ฅผ ์ œ์‹œํ•ฉ๋‹ˆ๋‹ค.")
673
-
674
- warning = gr.Markdown(get_warning_message())
675
-
676
- # ์ขŒ์ธก ์ž…๋ ฅ ์˜์—ญ
677
- with gr.Row():
678
- with gr.Column(scale=1):
679
- text_input1 = gr.Textbox(label="ํ‚ค์›Œ๋“œ 1 (ํ•„์ˆ˜)", placeholder="์˜ˆ: ์Šค๋งˆํŠธํฐ")
680
- text_input2 = gr.Textbox(label="ํ‚ค์›Œ๋“œ 2 (์„ ํƒ)", placeholder="์˜ˆ: ์ธ๊ณต์ง€๋Šฅ")
681
- text_input3 = gr.Textbox(label="ํ‚ค์›Œ๋“œ 3 (์„ ํƒ)", placeholder="์˜ˆ: ํ—ฌ์Šค์ผ€์–ด")
682
- # ์นดํ…Œ๊ณ ๋ฆฌ ์„ ํƒ ๋“œ๋กญ๋‹ค์šด ์ถ”๊ฐ€
683
- category_dropdown = gr.Dropdown(
684
- label="์นดํ…Œ๊ณ ๋ฆฌ ์„ ํƒ",
685
- choices=list(physical_transformation_categories.keys()),
686
- value=list(physical_transformation_categories.keys())[0],
687
- info="์ถœ๋ ฅํ•  ์นดํ…Œ๊ณ ๋ฆฌ๋ฅผ ์„ ํƒํ•˜์„ธ์š”."
688
- )
689
-
690
- status_msg = gr.Markdown("๐Ÿ’ก '์•„์ด๋””์–ด ์ƒ์„ฑํ•˜๊ธฐ' ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์•„์ด๋””์–ด ์ƒ์„ฑ์ด ์‹œ์ž‘๋ฉ๋‹ˆ๋‹ค.")
691
-
692
- processing_indicator = gr.HTML("""
693
- <div style="display: flex; justify-content: center; align-items: center; margin: 10px 0;">
694
- <div style="border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite;"></div>
695
- <p style="margin-left: 10px; font-weight: bold; color: #3498db;">์ฒ˜๋ฆฌ ์ค‘์ž…๋‹ˆ๋‹ค...</p>
696
- </div>
697
- <style>
698
- @keyframes spin {
699
- 0% { transform: rotate(0deg); }
700
- 100% { transform: rotate(360deg); }
701
- }
702
- </style>
703
- """, visible=False)
704
-
705
- submit_button = gr.Button("์•„์ด๋””์–ด ์ƒ์„ฑํ•˜๊ธฐ", variant="primary")
706
-
707
- # ์šฐ์ธก ์ถœ๋ ฅ ์˜์—ญ
708
- with gr.Column(scale=2):
709
- idea_output = gr.Markdown(label="์•„์ด๋””์–ด ๊ฒฐ๊ณผ")
710
-
711
- gr.Examples(
712
- examples=[
713
- ["์Šค๋งˆํŠธํฐ", "", "", list(physical_transformation_categories.keys())[0]],
714
- ["์ž๋™์ฐจ", "", "", list(physical_transformation_categories.keys())[0]],
715
- ["์ž๋™์ฐจ", "์ธ๊ณต์ง€๋Šฅ", "", list(physical_transformation_categories.keys())[0]],
716
- ["๋“œ๋ก ", "์ธ๊ณต์ง€๋Šฅ", "", list(physical_transformation_categories.keys())[0]],
717
- ["์šด๋™ํ™”", "์›จ์–ด๋Ÿฌ๋ธ”", "๊ฑด๊ฐ•", list(physical_transformation_categories.keys())[0]],
718
- ],
719
- inputs=[text_input1, text_input2, text_input3, category_dropdown],
720
- )
721
-
722
- def show_processing_indicator():
723
- return gr.update(visible=True)
724
-
725
- def hide_processing_indicator():
726
- return gr.update(visible=False)
727
-
728
- submit_button.click(
729
- fn=show_processing_indicator,
730
- inputs=None,
731
- outputs=processing_indicator
732
- ).then(
733
- fn=process_inputs,
734
- inputs=[text_input1, text_input2, text_input3, category_dropdown],
735
- outputs=idea_output
736
- ).then(
737
- fn=hide_processing_indicator,
738
- inputs=None,
739
- outputs=processing_indicator
740
- )
741
-
742
  if __name__ == "__main__":
743
  demo.launch(debug=True)
 
448
  outputs=processing_indicator
449
  )
450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  if __name__ == "__main__":
452
  demo.launch(debug=True)