Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -448,5 +448,296 @@ with gr.Blocks(title="ν€μλ κΈ°λ° μ°½μμ λ³ν μμ΄λμ΄ μμ±κΈ°",
|
|
448 |
outputs=processing_indicator
|
449 |
)
|
450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
if __name__ == "__main__":
|
452 |
demo.launch(debug=True)
|
|
|
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)
|