|
|
import gradio as gr |
|
|
import os |
|
|
import sys |
|
|
import tempfile |
|
|
from io import StringIO |
|
|
import traceback |
|
|
import inspect |
|
|
|
|
|
|
|
|
module_functions = {} |
|
|
|
|
|
|
|
|
def load_and_execute_module(module_name, module_key): |
|
|
"""ํ๊ฒฝ๋ณ์์์ ๋ชจ๋ ์ฝ๋๋ฅผ ๋ถ๋ฌ์์ ์คํํ๊ณ ํจ์๋ค์ ์ ์ฅ""" |
|
|
try: |
|
|
module_code = os.getenv(module_name) |
|
|
if not module_code: |
|
|
raise ValueError(f"ํ๊ฒฝ๋ณ์ {module_name}์ด ์ค์ ๋์ง ์์์ต๋๋ค.") |
|
|
|
|
|
|
|
|
before_globals = set(globals().keys()) |
|
|
|
|
|
|
|
|
exec(module_code, globals()) |
|
|
|
|
|
|
|
|
after_globals = set(globals().keys()) |
|
|
new_functions = after_globals - before_globals |
|
|
|
|
|
|
|
|
module_functions[module_key] = {} |
|
|
for func_name in new_functions: |
|
|
if callable(globals()[func_name]) and not func_name.startswith('_'): |
|
|
module_functions[module_key][func_name] = globals()[func_name] |
|
|
|
|
|
print(f"{module_name} ๋ชจ๋์ด ์ฑ๊ณต์ ์ผ๋ก ๋ก๋๋์์ต๋๋ค.") |
|
|
print(f"๋ก๋๋ ํจ์๋ค: {list(module_functions[module_key].keys())}") |
|
|
|
|
|
except Exception as e: |
|
|
print(f"{module_name} ๋ชจ๋ ๋ก๋ ์ค ์ค๋ฅ: {str(e)}") |
|
|
traceback.print_exc() |
|
|
module_functions[module_key] = {} |
|
|
|
|
|
|
|
|
print("๋ชจ๋๋ค์ ๋ก๋ํ๋ ์ค...") |
|
|
|
|
|
|
|
|
load_and_execute_module("INFO_BLOG_CODE", "info_blog") |
|
|
|
|
|
|
|
|
load_and_execute_module("TRAVEL_BLOG_CODE", "travel_blog") |
|
|
|
|
|
|
|
|
load_and_execute_module("PRODUCT_REVIEW_BLOG_CODE", "product_review_blog") |
|
|
|
|
|
|
|
|
load_and_execute_module("FEATURE_FOCUS_BLOG_CODE", "feature_focus_blog") |
|
|
|
|
|
|
|
|
load_and_execute_module("VISIT_REVIEW_BLOG_CODE", "visit_review_blog") |
|
|
|
|
|
print("๋ชจ๋ ๋ชจ๋ ๋ก๋ ์๋ฃ!") |
|
|
|
|
|
|
|
|
for module_key, functions in module_functions.items(): |
|
|
print(f"{module_key}: {list(functions.keys())}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_outline_1_wrapper(category, style, ref1, ref2, ref3): |
|
|
"""์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
|
|
|
if 'generate_outline_1' in module_functions.get('info_blog', {}): |
|
|
return module_functions['info_blog']['generate_outline_1'](category, style, ref1, ref2, ref3) |
|
|
elif 'generate_outline' in module_functions.get('info_blog', {}): |
|
|
return module_functions['info_blog']['generate_outline'](category, style, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
def generate_blog_post_1_wrapper(category, style, ref1, ref2, ref3, outline): |
|
|
"""์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_blog_post_1' in module_functions.get('info_blog', {}): |
|
|
return module_functions['info_blog']['generate_blog_post_1'](category, style, ref1, ref2, ref3, outline) |
|
|
elif 'generate_blog_post' in module_functions.get('info_blog', {}): |
|
|
return module_functions['info_blog']['generate_blog_post'](category, style, outline, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ ๋ณด์ฑ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
|
|
|
def generate_outline_2_wrapper(category, style, ref1, ref2, ref3): |
|
|
"""์ฌํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_outline_2' in module_functions.get('travel_blog', {}): |
|
|
return module_functions['travel_blog']['generate_outline_2'](category, style, ref1, ref2, ref3) |
|
|
elif 'generate_outline' in module_functions.get('travel_blog', {}): |
|
|
return module_functions['travel_blog']['generate_outline'](category, style, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ฌํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ฌํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
def generate_blog_post_2_wrapper(category, style, ref1, ref2, ref3, outline): |
|
|
"""์ฌํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_blog_post_2' in module_functions.get('travel_blog', {}): |
|
|
return module_functions['travel_blog']['generate_blog_post_2'](category, style, ref1, ref2, ref3, outline) |
|
|
elif 'generate_blog_post' in module_functions.get('travel_blog', {}): |
|
|
return module_functions['travel_blog']['generate_blog_post'](category, style, outline, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ฌํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ฌํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
|
|
|
def generate_outline_3_wrapper(category, style, ref1, ref2, ref3): |
|
|
"""์ํํ๊ธฐ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_outline_3' in module_functions.get('product_review_blog', {}): |
|
|
return module_functions['product_review_blog']['generate_outline_3'](category, style, ref1, ref2, ref3) |
|
|
elif 'generate_outline' in module_functions.get('product_review_blog', {}): |
|
|
return module_functions['product_review_blog']['generate_outline'](category, style, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ํํ๊ธฐ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ํํ๊ธฐ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
def generate_blog_post_3_wrapper(category, style, ref1, ref2, ref3, outline): |
|
|
"""์ํํ๊ธฐ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_blog_post_3' in module_functions.get('product_review_blog', {}): |
|
|
return module_functions['product_review_blog']['generate_blog_post_3'](category, style, ref1, ref2, ref3, outline) |
|
|
elif 'generate_blog_post' in module_functions.get('product_review_blog', {}): |
|
|
return module_functions['product_review_blog']['generate_blog_post'](category, style, outline, ref1, ref2, ref3) |
|
|
else: |
|
|
return "์ํํ๊ธฐ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"์ํํ๊ธฐ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
|
|
|
def generate_outline_4_wrapper(category, style, ref1, ref2, ref3): |
|
|
"""ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_outline_4' in module_functions.get('feature_focus_blog', {}): |
|
|
result = module_functions['feature_focus_blog']['generate_outline_4'](category, style, ref1, ref2, ref3) |
|
|
if isinstance(result, tuple) and len(result) == 3: |
|
|
return result |
|
|
else: |
|
|
return (str(result), "", "") |
|
|
elif 'generate_outline' in module_functions.get('feature_focus_blog', {}): |
|
|
result = module_functions['feature_focus_blog']['generate_outline'](category, style, ref1, ref2, ref3) |
|
|
return (str(result), "", "") |
|
|
else: |
|
|
return ("ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.", "", "") |
|
|
except Exception as e: |
|
|
return (f"ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}", "", "") |
|
|
|
|
|
def generate_blog_post_4_wrapper(category, style, ref1, ref2, ref3, outline): |
|
|
"""ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_blog_post_4' in module_functions.get('feature_focus_blog', {}): |
|
|
return module_functions['feature_focus_blog']['generate_blog_post_4'](category, style, ref1, ref2, ref3, outline) |
|
|
elif 'generate_blog_post' in module_functions.get('feature_focus_blog', {}): |
|
|
return module_functions['feature_focus_blog']['generate_blog_post'](category, style, outline, ref1, ref2, ref3) |
|
|
else: |
|
|
return "ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"ํต์ฌ๊ธฐ๋ฅ์ง์คํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
|
|
|
def generate_outline_5_wrapper(category, style, ref1, ref2, ref3, photo_recommendations): |
|
|
"""๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_outline_5' in module_functions.get('visit_review_blog', {}): |
|
|
return module_functions['visit_review_blog']['generate_outline_5'](category, style, ref1, ref2, ref3, photo_recommendations) |
|
|
elif 'generate_outline' in module_functions.get('visit_review_blog', {}): |
|
|
return module_functions['visit_review_blog']['generate_outline'](category, style, ref1, ref2, ref3, photo_recommendations) |
|
|
else: |
|
|
return "๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ์์๋ผ์ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
def generate_blog_post_5_wrapper(category, style, ref1, ref2, ref3, outline, photo_recommendations): |
|
|
"""๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ๋ํผ""" |
|
|
try: |
|
|
if 'generate_blog_post_5' in module_functions.get('visit_review_blog', {}): |
|
|
return module_functions['visit_review_blog']['generate_blog_post_5'](category, style, ref1, ref2, ref3, outline, photo_recommendations) |
|
|
elif 'generate_blog_post' in module_functions.get('visit_review_blog', {}): |
|
|
return module_functions['visit_review_blog']['generate_blog_post'](category, style, ref1, ref2, ref3, outline, photo_recommendations) |
|
|
else: |
|
|
return "๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ํจ์๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค." |
|
|
except Exception as e: |
|
|
return f"๋ฐฉ๋ฌธํ๊ธฐํ ๋ธ๋ก๊ทธ ๊ธ ์์ฑ ์ค ์ค๋ฅ: {str(e)}" |
|
|
|
|
|
print("๋ํผ ํจ์๋ค ์ ์ ์๋ฃ!") |
|
|
|
|
|
|
|
|
def interface(): |
|
|
with gr.Blocks() as demo: |
|
|
gr.Markdown("# ๋ธ๋ก๊ทธ ํฌ์คํ
") |
|
|
|
|
|
|
|
|
with gr.Tab("์ ๋ณด์ฑ"): |
|
|
category_1 = gr.Radio(choices=['์ผ๋ฐ', '์ํ๊ฑด๊ฐ'], label="ํฌ์คํ
์นดํ
๊ณ ๋ฆฌ", value="์ผ๋ฐ") |
|
|
style_1 = gr.Radio(choices=['์น๊ทผํ', '์ผ๋ฐ', '์ ๋ฌธ์ ์ธ'], label="ํฌ์คํ
์คํ์ผ", value="์น๊ทผํ") |
|
|
ref1_1 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 1", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref2_1 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 2", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref3_1 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 3", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
outline_button_1 = gr.Button("์์๋ผ์ธ ์์ฑ") |
|
|
outline_output_1 = gr.Textbox(label="์์ฑ๋ ์์๋ผ์ธ") |
|
|
|
|
|
outline_1 = gr.Textbox(label="์์ฑํ ์์๋ผ์ธ", placeholder="์์ฑ๋ ์์๋ผ์ธ์ ์
๋ ฅํ์ธ์") |
|
|
blog_button_1 = gr.Button("๋ธ๋ก๊ทธ ๊ธ ์์ฑ") |
|
|
blog_output_1 = gr.HTML(label="์์ฑ๋ ๋ธ๋ก๊ทธ ๊ธ (HTML ํ์)") |
|
|
|
|
|
outline_button_1.click(generate_outline_1_wrapper, inputs=[category_1, style_1, ref1_1, ref2_1, ref3_1], outputs=outline_output_1) |
|
|
blog_button_1.click(generate_blog_post_1_wrapper, inputs=[category_1, style_1, ref1_1, ref2_1, ref3_1, outline_1], outputs=blog_output_1) |
|
|
|
|
|
|
|
|
with gr.Tab("์ฌํ"): |
|
|
category_2 = gr.Radio(choices=['์ฌํ ๋จ์ผ', '์ฌํ ์ฝ์ค'], label="ํฌ์คํ
์นดํ
๊ณ ๋ฆฌ", value="์ฌํ ๋จ์ผ") |
|
|
style_2 = gr.Radio(choices=['์น๊ทผํ', '์ผ๋ฐ', '์ ๋ฌธ์ ์ธ'], label="ํฌ์คํ
์คํ์ผ", value="์น๊ทผํ") |
|
|
ref1_2 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 1", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref2_2 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 2", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref3_2 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 3", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
outline_button_2 = gr.Button("์์๋ผ์ธ ์์ฑ") |
|
|
outline_output_2 = gr.Textbox(label="์์ฑ๋ ์์๋ผ์ธ") |
|
|
|
|
|
outline_2 = gr.Textbox(label="์์ฑํ ์์๋ผ์ธ", placeholder="์์ฑ๋ ์์๋ผ์ธ์ ์
๋ ฅํ์ธ์") |
|
|
blog_button_2 = gr.Button("๋ธ๋ก๊ทธ ๊ธ ์์ฑ") |
|
|
blog_output_2 = gr.HTML(label="์์ฑ๋ ๋ธ๋ก๊ทธ ๊ธ (HTML ํ์)") |
|
|
|
|
|
outline_button_2.click(generate_outline_2_wrapper, inputs=[category_2, style_2, ref1_2, ref2_2, ref3_2], outputs=outline_output_2) |
|
|
blog_button_2.click(generate_blog_post_2_wrapper, inputs=[category_2, style_2, ref1_2, ref2_2, ref3_2, outline_2], outputs=blog_output_2) |
|
|
|
|
|
|
|
|
with gr.Tab("์ํํ๊ธฐ"): |
|
|
category_3 = gr.Radio(choices=['์ผ๋ฐ', '๊ธฐ๋ฅ์ง์คํ', '๊ณ ๊ฐ๋ฐ์ํ'], label="ํฌ์คํ
์นดํ
๊ณ ๋ฆฌ", value="์ผ๋ฐ") |
|
|
style_3 = gr.Radio(choices=['์น๊ทผํ', '์ผ๋ฐ', '์ ๋ฌธ์ ์ธ'], label="ํฌ์คํ
์คํ์ผ", value="์น๊ทผํ") |
|
|
ref1_3 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 1", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref2_3 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 2", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref3_3 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 3", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
outline_button_3 = gr.Button("์์๋ผ์ธ ์์ฑ") |
|
|
outline_output_3 = gr.Textbox(label="์์ฑ๋ ์์๋ผ์ธ") |
|
|
|
|
|
outline_3 = gr.Textbox(label="์์ฑํ ์์๋ผ์ธ", placeholder="์์ฑ๋ ์์๋ผ์ธ์ ์
๋ ฅํ์ธ์") |
|
|
blog_button_3 = gr.Button("๋ธ๋ก๊ทธ ๊ธ ์์ฑ") |
|
|
blog_output_3 = gr.HTML(label="์์ฑ๋ ๋ธ๋ก๊ทธ ๊ธ (HTML ํ์)") |
|
|
|
|
|
outline_button_3.click(generate_outline_3_wrapper, inputs=[category_3, style_3, ref1_3, ref2_3, ref3_3], outputs=outline_output_3) |
|
|
blog_button_3.click(generate_blog_post_3_wrapper, inputs=[category_3, style_3, ref1_3, ref2_3, ref3_3, outline_3], outputs=blog_output_3) |
|
|
|
|
|
|
|
|
with gr.Tab("ํต์ฌ๊ธฐ๋ฅ์ง์คํ"): |
|
|
category_4 = gr.Radio(choices=['ํต์ฌ๊ธฐ๋ฅ์ง์คํ'], label="ํฌ์คํ
์นดํ
๊ณ ๋ฆฌ", value="ํต์ฌ๊ธฐ๋ฅ์ง์คํ") |
|
|
style_4 = gr.Radio(choices=['์น๊ทผํ', '์ผ๋ฐ', '์ ๋ฌธ์ ์ธ'], label="ํฌ์คํ
์คํ์ผ", value="์น๊ทผํ") |
|
|
ref1_4 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 1", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref2_4 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 2", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref3_4 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 3", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
outline_button_4 = gr.Button("ํต์ฌ๊ธฐ๋ฅ ์ ์ ํ๊ธฐ") |
|
|
outline_result1 = gr.Textbox(label="ํต์ฌ๊ธฐ๋ฅ 1") |
|
|
outline_result2 = gr.Textbox(label="ํต์ฌ๊ธฐ๋ฅ 2") |
|
|
outline_result3 = gr.Textbox(label="ํต์ฌ๊ธฐ๋ฅ 3") |
|
|
outline_4 = gr.Textbox(label="์์ฑํ ํต์ฌ๊ธฐ๋ฅ ์ฃผ์ ์ค์ 1๊ฐ๋ง ์
๋ ฅํด์ฃผ์ธ์", placeholder="ํต์ฌ๊ธฐ๋ฅ 1๊ฐ๋ง ์
๋ ฅํ์ธ์") |
|
|
blog_button_4 = gr.Button("๋ธ๋ก๊ทธ ๊ธ ์์ฑ") |
|
|
blog_output_4 = gr.HTML(label="์์ฑ๋ ๋ธ๋ก๊ทธ ๊ธ (HTML ํ์)") |
|
|
|
|
|
outline_button_4.click(generate_outline_4_wrapper, inputs=[category_4, style_4, ref1_4, ref2_4, ref3_4], outputs=[outline_result1, outline_result2, outline_result3]) |
|
|
blog_button_4.click(generate_blog_post_4_wrapper, inputs=[category_4, style_4, ref1_4, ref2_4, ref3_4, outline_4], outputs=blog_output_4) |
|
|
|
|
|
|
|
|
with gr.Tab("๋ฐฉ๋ฌธํ๊ธฐํ"): |
|
|
category_5 = gr.Radio(choices=['๋ฐฉ๋ฌธํ๊ธฐํ'], label="ํฌ์คํ
์นดํ
๊ณ ๋ฆฌ", value="๋ฐฉ๋ฌธํ๊ธฐํ") |
|
|
style_5 = gr.Radio(choices=['์น๊ทผํ', '์ผ๋ฐ', '์ ๋ฌธ์ ์ธ'], label="ํฌ์คํ
์คํ์ผ", value="์น๊ทผํ") |
|
|
ref1_5 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 1", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref2_5 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 2", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
ref3_5 = gr.Textbox(label="์ฐธ๊ณ ๊ธ 3", placeholder="์ฐธ๊ณ ํ ๊ธ์ ์
๋ ฅํ์ธ์") |
|
|
photo_recommendations_5 = gr.Textbox(label="์ฌ์ง ํํ ํค์๋", placeholder="์ฌ์ง ์ถ์ฒ ํค์๋๋ฅผ ์
๋ ฅํ์ธ์") |
|
|
outline_button_5 = gr.Button("์์๋ผ์ธ ์์ฑ") |
|
|
outline_output_5 = gr.Textbox(label="์์ฑ๋ ์์๋ผ์ธ") |
|
|
|
|
|
outline_5 = gr.Textbox(label="์์ฑํ ์์๋ผ์ธ", placeholder="์์ฑ๋ ์์๋ผ์ธ์ ์
๋ ฅํ์ธ์") |
|
|
blog_button_5 = gr.Button("๋ธ๋ก๊ทธ ๊ธ ์์ฑ") |
|
|
blog_output_5 = gr.HTML(label="์์ฑ๋ ๋ธ๋ก๊ทธ ๊ธ (HTML ํ์)") |
|
|
|
|
|
outline_button_5.click( |
|
|
generate_outline_5_wrapper, |
|
|
inputs=[category_5, style_5, ref1_5, ref2_5, ref3_5, photo_recommendations_5], |
|
|
outputs=outline_output_5 |
|
|
) |
|
|
blog_button_5.click( |
|
|
generate_blog_post_5_wrapper, |
|
|
inputs=[category_5, style_5, ref1_5, ref2_5, ref3_5, outline_5, photo_recommendations_5], |
|
|
outputs=blog_output_5 |
|
|
) |
|
|
|
|
|
return demo |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
interface().launch(share=True) |