Update app.py
Browse files
app.py
CHANGED
@@ -87,35 +87,80 @@ footer {
|
|
87 |
"""
|
88 |
|
89 |
|
90 |
-
#
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
gr.
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
gr.
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
if __name__ == "__main__":
|
121 |
-
demo.launch()
|
|
|
87 |
"""
|
88 |
|
89 |
|
90 |
+
# ... (μ΄μ import λ¬Έκ³Ό ν¨μλ€μ λμΌ)
|
91 |
+
|
92 |
+
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
|
93 |
+
with gr.Row():
|
94 |
+
with gr.Column(scale=2):
|
95 |
+
chatbot = gr.Chatbot()
|
96 |
+
msg = gr.Textbox(label="λ©μμ§λ₯Ό μ
λ ₯νμΈμ")
|
97 |
+
clear = gr.ClearButton([msg, chatbot])
|
98 |
+
|
99 |
+
with gr.Column(scale=1):
|
100 |
+
with gr.Group():
|
101 |
+
fashion_file = gr.File(label="Fashion Code File", file_types=[".cod", ".txt", ".py"])
|
102 |
+
fashion_analyze = gr.Button("ν¨μ
μ½λ λΆμ")
|
103 |
+
|
104 |
+
uhd_file = gr.File(label="UHD Image Code File", file_types=[".cod", ".txt", ".py"])
|
105 |
+
uhd_analyze = gr.Button("UHD μ΄λ―Έμ§ μ½λ λΆμ")
|
106 |
+
|
107 |
+
mixgen_file = gr.File(label="MixGEN Code File", file_types=[".cod", ".txt", ".py"])
|
108 |
+
mixgen_analyze = gr.Button("MixGEN μ½λ λΆμ")
|
109 |
+
|
110 |
+
parquet_file = gr.File(label="Parquet File", file_types=[".parquet"])
|
111 |
+
parquet_analyze = gr.Button("Parquet νμΌ λΆμ")
|
112 |
+
|
113 |
+
with gr.Accordion("κ³ κΈ μ€μ ", open=False):
|
114 |
+
system_message = gr.Textbox(label="System Message", value="")
|
115 |
+
max_tokens = gr.Slider(minimum=1, maximum=8000, value=4000, label="Max Tokens")
|
116 |
+
temperature = gr.Slider(minimum=0, maximum=1, value=0.7, label="Temperature")
|
117 |
+
top_p = gr.Slider(minimum=0, maximum=1, value=0.9, label="Top P")
|
118 |
+
|
119 |
+
# λΆμ λ²νΌ ν΄λ¦ μ΄λ²€νΈ νΈλ€λ¬
|
120 |
+
def analyze_file(file_type):
|
121 |
+
if file_type == "fashion":
|
122 |
+
return "ν¨μ
μ½λ μ€ν"
|
123 |
+
elif file_type == "uhd":
|
124 |
+
return "UHD μ΄λ―Έμ§ μ½λ μ€ν"
|
125 |
+
elif file_type == "mixgen":
|
126 |
+
return "MixGEN μ½λ μ€ν"
|
127 |
+
elif file_type == "parquet":
|
128 |
+
return "test.parquet μ€ν"
|
129 |
+
|
130 |
+
# μ±ν
μ μΆ νΈλ€λ¬
|
131 |
+
def chat(message, history):
|
132 |
+
return respond(
|
133 |
+
message=message,
|
134 |
+
history=history,
|
135 |
+
fashion_file=fashion_file.value,
|
136 |
+
uhd_file=uhd_file.value,
|
137 |
+
mixgen_file=mixgen_file.value,
|
138 |
+
parquet_file=parquet_file.value,
|
139 |
+
system_message=system_message.value,
|
140 |
+
max_tokens=max_tokens.value,
|
141 |
+
temperature=temperature.value,
|
142 |
+
top_p=top_p.value,
|
143 |
+
)
|
144 |
+
|
145 |
+
# μ΄λ²€νΈ λ°μΈλ©
|
146 |
+
msg.submit(chat, [msg, chatbot], [msg, chatbot])
|
147 |
+
fashion_analyze.click(lambda: analyze_file("fashion"), None, msg)
|
148 |
+
uhd_analyze.click(lambda: analyze_file("uhd"), None, msg)
|
149 |
+
mixgen_analyze.click(lambda: analyze_file("mixgen"), None, msg)
|
150 |
+
parquet_analyze.click(lambda: analyze_file("parquet"), None, msg)
|
151 |
+
|
152 |
+
# μμ μΆκ°
|
153 |
+
gr.Examples(
|
154 |
+
examples=[
|
155 |
+
["μμΈν μ¬μ© λ°©λ²μ λ§μΉ νλ©΄μ 보면μ μ€λͺ
νλ―μ΄ 4000 ν ν° μ΄μ μμΈν μ€λͺ
νλΌ"],
|
156 |
+
["FAQ 20건μ μμΈνκ² μμ±νλΌ. 4000ν ν° μ΄μ μ¬μ©νλΌ."],
|
157 |
+
["μ¬μ© λ°©λ²κ³Ό μ°¨λ³μ , νΉμ§, κ°μ μ μ€μ¬μΌλ‘ 4000 ν ν° μ΄μ μ νλΈ μμ μ€ν¬λ¦½νΈ ννλ‘ μμ±νλΌ"],
|
158 |
+
["λ³Έ μλΉμ€λ₯Ό SEO μ΅μ ννμ¬ λΈλ‘κ·Έ ν¬μ€νΈλ‘ 4000 ν ν° μ΄μ μμ±νλΌ"],
|
159 |
+
["νΉν μΆμμ νμ©ν κΈ°μ λ° λΉμ¦λμ€λͺ¨λΈ μΈ‘λ©΄μ ν¬ν¨νμ¬ νΉν μΆμμ ꡬμ±μ λ§κ² μμ±νλΌ"],
|
160 |
+
["κ³μ μ΄μ΄μ λ΅λ³νλΌ"],
|
161 |
+
],
|
162 |
+
inputs=msg,
|
163 |
+
)
|
164 |
|
165 |
if __name__ == "__main__":
|
166 |
+
demo.launch()
|