openfree commited on
Commit
63c5e29
โ€ข
1 Parent(s): 1665b7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -30
app.py CHANGED
@@ -87,35 +87,80 @@ footer {
87
  """
88
 
89
 
90
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
91
- demo = gr.ChatInterface(
92
- respond,
93
- additional_inputs=[
94
- gr.File(label="Fashion Code File", file_types=[".cod", ".txt", ".py"]),
95
- gr.File(label="UHD Image Code File", file_types=[".cod", ".txt", ".py"]),
96
- gr.File(label="MixGEN Code File", file_types=[".cod", ".txt", ".py"]),
97
- gr.File(label="Parquet File", file_types=[".parquet"]),
98
- gr.Textbox(label="System Message", value=""),
99
- gr.Slider(minimum=1, maximum=8000, value=4000, label="Max Tokens"),
100
- gr.Slider(minimum=0, maximum=1, value=0.7, label="Temperature"),
101
- gr.Slider(minimum=0, maximum=1, value=0.9, label="Top P"),
102
- ],
103
- examples=[
104
- ["ํŒจ์…˜ ์ฝ”๋“œ ์‹คํ–‰"],
105
- ["UHD ์ด๋ฏธ์ง€ ์ฝ”๋“œ ์‹คํ–‰"],
106
- ["MixGEN ์ฝ”๋“œ ์‹คํ–‰"],
107
- ["test.parquet ์‹คํ–‰"],
108
- ["์ƒ์„ธํ•œ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ๋งˆ์น˜ ํ™”๋ฉด์„ ๋ณด๋ฉด์„œ ์„ค๋ช…ํ•˜๋“ฏ์ด 4000 ํ† ํฐ ์ด์ƒ ์ž์„ธํžˆ ์„ค๋ช…ํ•˜๋ผ"],
109
- ["FAQ 20๊ฑด์„ ์ƒ์„ธํ•˜๊ฒŒ ์ž‘์„ฑํ•˜๋ผ. 4000ํ† ํฐ ์ด์ƒ ์‚ฌ์šฉํ•˜๋ผ."],
110
- ["์‚ฌ์šฉ ๋ฐฉ๋ฒ•๊ณผ ์ฐจ๋ณ„์ , ํŠน์ง•, ๊ฐ•์ ์„ ์ค‘์‹ฌ์œผ๋กœ 4000 ํ† ํฐ ์ด์ƒ ์œ ํŠœ๋ธŒ ์˜์ƒ ์Šคํฌ๋ฆฝํŠธ ํ˜•ํƒœ๋กœ ์ž‘์„ฑํ•˜๋ผ"],
111
- ["๋ณธ ์„œ๋น„์Šค๋ฅผ SEO ์ตœ์ ํ™”ํ•˜์—ฌ ๋ธ”๋กœ๊ทธ ํฌ์ŠคํŠธ๋กœ 4000 ํ† ํฐ ์ด์ƒ ์ž‘์„ฑํ•˜๋ผ"],
112
- ["ํŠนํ—ˆ ์ถœ์›์— ํ™œ์šฉํ•  ๊ธฐ์ˆ  ๋ฐ ๋น„์ฆˆ๋‹ˆ์Šค๋ชจ๋ธ ์ธก๋ฉด์„ ํฌํ•จํ•˜์—ฌ ํŠนํ—ˆ ์ถœ์›์„œ ๊ตฌ์„ฑ์— ๋งž๊ฒŒ ์ž‘์„ฑํ•˜๋ผ"],
113
- ["๊ณ„์† ์ด์–ด์„œ ๋‹ต๋ณ€ํ•˜๋ผ"],
114
- ],
115
- theme="Yntec/HaleyCH_Theme_Orange",
116
- css=css,
117
- cache_examples=False,
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()