File size: 9,875 Bytes
394327d
f6be4d2
394327d
 
810dee9
 
 
 
 
 
a9cc41c
f6be4d2
394327d
 
 
 
 
 
 
 
f6be4d2
394327d
 
 
 
 
 
 
 
f6be4d2
394327d
 
 
 
 
 
 
 
f6be4d2
394327d
 
 
 
 
 
 
 
f6be4d2
394327d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import gradio as gr
from gradio_client import Client
import os

# ๊ฐ ๋ชจ๋“ˆ์—์„œ ํ•จ์ˆ˜ import (PDF ํ•จ์ˆ˜ ์ œ๊ฑฐ)
from info_blog import generate_outline_1, generate_blog_post_1
from travel_blog import generate_outline_2, generate_blog_post_2
from product_review_blog import generate_outline_3, generate_blog_post_3
from feature_focus_blog import generate_outline_4, generate_blog_post_4
from visit_review_blog import generate_outline_5, generate_blog_post_5

# ๊ธฐ์กด API ํ•จ์ˆ˜ ์ •์˜ (์ •๋ณด์„ฑ)
def generate_outline_1_api(category, style, ref1, ref2, ref3):
    result = generate_outline_1(category, style, ref1, ref2, ref3)
    return result

def generate_blog_post_1_api(category, style, ref1, ref2, ref3, outline_input):
    result = generate_blog_post_1(category, style, ref1, ref2, ref3, outline_input)
    return result

# ๊ธฐ์กด API ํ•จ์ˆ˜ ์ •์˜ (์—ฌํ–‰)
def generate_outline_2_api(category, style, ref1, ref2, ref3):
    result = generate_outline_2(category, style, ref1, ref2, ref3)
    return result

def generate_blog_post_2_api(category, style, ref1, ref2, ref3, outline_input):
    result = generate_blog_post_2(category, style, ref1, ref2, ref3, outline_input)
    return result

# ๊ธฐ์กด API ํ•จ์ˆ˜ ์ •์˜ (์ƒํ’ˆํ›„๊ธฐ)
def generate_outline_3_api(category, style, ref1, ref2, ref3):
    result = generate_outline_3(category, style, ref1, ref2, ref3)
    return result

def generate_blog_post_3_api(category, style, ref1, ref2, ref3, outline_input):
    result = generate_blog_post_3(category, style, ref1, ref2, ref3, outline_input)
    return result

# ์ƒˆ๋กœ์šด API ํ•จ์ˆ˜ ์ •์˜ (ํ•ต์‹ฌ๊ธฐ๋Šฅ์ง‘์ค‘ํ˜•)
def generate_outline_4_api(category, style, ref1, ref2, ref3):
    result = generate_outline_4(category, style, ref1, ref2, ref3)
    return result

def generate_blog_post_4_api(category, style, ref1, ref2, ref3, selected_feature):
    result = generate_blog_post_4(category, style, ref1, ref2, ref3, selected_feature)
    return result

# ์ƒˆ๋กœ์šด API ํ•จ์ˆ˜ ์ •์˜ (๋ฐฉ๋ฌธํ›„๊ธฐํ˜•)
def generate_outline_5_api(category, style, ref1, ref2, ref3, photo_recommendations):
    result = generate_outline_5(category, style, ref1, ref2, ref3, photo_recommendations)
    return result

def generate_blog_post_5_api(category, style, ref1, ref2, ref3, outline_input, photo_recommendations):
    result = generate_blog_post_5(category, style, ref1, ref2, ref3, outline_input, photo_recommendations)
    return result

# Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค๊ณ„ (Gradio 5.0 ์ด์ƒ)
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_api, inputs=[category_1, style_1, ref1_1, ref2_1, ref3_1], outputs=outline_output_1)
            blog_button_1.click(generate_blog_post_1_api, 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_api, inputs=[category_2, style_2, ref1_2, ref2_2, ref3_2], outputs=outline_output_2)
            blog_button_2.click(generate_blog_post_2_api, 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_api, inputs=[category_3, style_3, ref1_3, ref2_3, ref3_3], outputs=outline_output_3)
            blog_button_3.click(generate_blog_post_3_api, 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_api, 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_api, 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_api,
                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_api,
                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)