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()
|