Spaces:
Running
on
Zero
Running
on
Zero
cutechicken
commited on
Commit
โข
9e9b867
1
Parent(s):
cf528b4
Update app.py
Browse files
app.py
CHANGED
@@ -1,403 +1,166 @@
|
|
1 |
-
import os
|
2 |
-
from dotenv import load_dotenv
|
3 |
-
import gradio as gr
|
4 |
-
import pandas as pd
|
5 |
-
import json
|
6 |
-
from datetime import datetime
|
7 |
import torch
|
8 |
-
|
9 |
import spaces
|
|
|
|
|
10 |
from threading import Thread
|
|
|
|
|
11 |
|
12 |
-
|
13 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
14 |
MODEL_ID = "CohereForAI/c4ai-command-r7b-12-2024"
|
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 |
-
return_tensors="pt",
|
77 |
-
padding=True,
|
78 |
-
truncation=True,
|
79 |
-
max_length=4096
|
80 |
-
)
|
81 |
-
|
82 |
-
# ๋ชจ๋ ํ
์๋ฅผ GPU๋ก ์ด๋
|
83 |
-
input_ids = inputs.input_ids.to(self.model.device)
|
84 |
-
attention_mask = inputs.attention_mask.to(self.model.device)
|
85 |
-
|
86 |
-
# ์์ฑ
|
87 |
-
with torch.no_grad():
|
88 |
-
outputs = self.model.generate(
|
89 |
-
input_ids=input_ids,
|
90 |
-
attention_mask=attention_mask,
|
91 |
-
max_new_tokens=max_tokens,
|
92 |
-
do_sample=True,
|
93 |
-
temperature=temperature,
|
94 |
-
top_p=top_p,
|
95 |
-
pad_token_id=self.tokenizer.pad_token_id,
|
96 |
-
eos_token_id=self.tokenizer.eos_token_id,
|
97 |
-
num_return_sequences=1
|
98 |
-
)
|
99 |
-
|
100 |
-
# ๋์ฝ๋ฉ ์ ์ CPU๋ก ์ด๋
|
101 |
-
outputs = outputs.cpu()
|
102 |
-
generated_text = self.tokenizer.decode(
|
103 |
-
outputs[0][input_ids.shape[1]:],
|
104 |
-
skip_special_tokens=True
|
105 |
-
)
|
106 |
-
|
107 |
-
# ๋จ์ด ๋จ์๋ก ์คํธ๋ฆฌ๋ฐ
|
108 |
-
words = generated_text.split()
|
109 |
-
for word in words:
|
110 |
-
yield type('Response', (), {
|
111 |
-
'choices': [type('Choice', (), {
|
112 |
-
'delta': {'content': word + " "}
|
113 |
-
})()]
|
114 |
-
})()
|
115 |
-
|
116 |
-
except Exception as e:
|
117 |
-
print(f"์๋ต ์์ฑ ์ค ์ค๋ฅ ๋ฐ์: {e}")
|
118 |
-
raise Exception(f"์๋ต ์์ฑ ์คํจ: {e}")
|
119 |
-
|
120 |
-
class ChatHistory:
|
121 |
-
def __init__(self):
|
122 |
-
self.history = []
|
123 |
-
self.history_file = "/tmp/chat_history.json"
|
124 |
-
self.load_history()
|
125 |
-
|
126 |
-
def add_conversation(self, user_msg: str, assistant_msg: str):
|
127 |
-
conversation = {
|
128 |
-
"timestamp": datetime.now().isoformat(),
|
129 |
-
"messages": [
|
130 |
-
{"role": "user", "content": user_msg},
|
131 |
-
{"role": "assistant", "content": assistant_msg}
|
132 |
-
]
|
133 |
-
}
|
134 |
-
self.history.append(conversation)
|
135 |
-
self.save_history()
|
136 |
-
|
137 |
-
def format_for_display(self):
|
138 |
-
formatted = []
|
139 |
-
for conv in self.history:
|
140 |
-
formatted.append([
|
141 |
-
conv["messages"][0]["content"],
|
142 |
-
conv["messages"][1]["content"]
|
143 |
-
])
|
144 |
-
return formatted
|
145 |
-
|
146 |
-
def get_messages_for_api(self):
|
147 |
-
messages = []
|
148 |
-
for conv in self.history:
|
149 |
-
messages.extend([
|
150 |
-
{"role": "user", "content": conv["messages"][0]["content"]},
|
151 |
-
{"role": "assistant", "content": conv["messages"][1]["content"]}
|
152 |
-
])
|
153 |
-
return messages
|
154 |
-
|
155 |
-
def clear_history(self):
|
156 |
-
self.history = []
|
157 |
-
self.save_history()
|
158 |
-
|
159 |
-
def save_history(self):
|
160 |
-
try:
|
161 |
-
with open(self.history_file, 'w', encoding='utf-8') as f:
|
162 |
-
json.dump(self.history, f, ensure_ascii=False, indent=2)
|
163 |
-
except Exception as e:
|
164 |
-
print(f"ํ์คํ ๋ฆฌ ์ ์ฅ ์คํจ: {e}")
|
165 |
-
|
166 |
-
def load_history(self):
|
167 |
-
try:
|
168 |
-
if os.path.exists(self.history_file):
|
169 |
-
with open(self.history_file, 'r', encoding='utf-8') as f:
|
170 |
-
self.history = json.load(f)
|
171 |
-
except Exception as e:
|
172 |
-
print(f"ํ์คํ ๋ฆฌ ๋ก๋ ์คํจ: {e}")
|
173 |
-
self.history = []
|
174 |
-
|
175 |
-
# ์ ์ญ ์ธ์คํด์ค ์์ฑ
|
176 |
-
chat_history = ChatHistory()
|
177 |
-
model_manager = ModelManager()
|
178 |
-
|
179 |
-
def analyze_file_content(content, file_type):
|
180 |
-
"""Analyze file content and return structural summary"""
|
181 |
-
if file_type in ['parquet', 'csv']:
|
182 |
-
try:
|
183 |
-
lines = content.split('\n')
|
184 |
-
header = lines[0]
|
185 |
-
columns = header.count('|') - 1
|
186 |
-
rows = len(lines) - 3
|
187 |
-
return f"๐ ๋ฐ์ดํฐ์
๊ตฌ์กฐ: {columns}๊ฐ ์ปฌ๋ผ, {rows}๊ฐ ๋ฐ์ดํฐ"
|
188 |
-
except:
|
189 |
-
return "โ ๋ฐ์ดํฐ์
๊ตฌ์กฐ ๋ถ์ ์คํจ"
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
try:
|
264 |
-
# ์ฒซ ๋ฉ์์ง์ผ ๋ ๋ชจ๋ธ ๋ก๋ฉ
|
265 |
-
model_manager.ensure_model_loaded()
|
266 |
-
|
267 |
-
if uploaded_file:
|
268 |
-
content, file_type = read_uploaded_file(uploaded_file)
|
269 |
-
if file_type == "error":
|
270 |
-
error_message = content
|
271 |
-
chat_history.add_conversation(message, error_message)
|
272 |
-
return "", history + [[message, error_message]]
|
273 |
-
|
274 |
-
file_summary = analyze_file_content(content, file_type)
|
275 |
-
|
276 |
-
if file_type in ['parquet', 'csv']:
|
277 |
-
system_message += f"\n\nํ์ผ ๋ด์ฉ:\n```markdown\n{content}\n```"
|
278 |
-
else:
|
279 |
-
system_message += f"\n\nํ์ผ ๋ด์ฉ:\n```\n{content}\n```"
|
280 |
-
|
281 |
-
if message == "ํ์ผ ๋ถ์์ ์์ํฉ๋๋ค...":
|
282 |
-
message = f"""[ํ์ผ ๊ตฌ์กฐ ๋ถ์] {file_summary}
|
283 |
-
๋ค์ ๊ด์ ์์ ๋์์ ๋๋ฆฌ๊ฒ ์ต๋๋ค:
|
284 |
-
1. ๐ ์ ๋ฐ์ ์ธ ๋ด์ฉ ํ์
|
285 |
-
2. ๐ก ์ฃผ์ ํน์ง ์ค๋ช
|
286 |
-
3. ๐ฏ ์ค์ฉ์ ์ธ ํ์ฉ ๋ฐฉ์
|
287 |
-
4. โจ ๊ฐ์ ์ ์
|
288 |
-
5. ๐ฌ ์ถ๊ฐ ์ง๋ฌธ์ด๋ ํ์ํ ์ค๋ช
"""
|
289 |
-
|
290 |
-
messages = [{"role": "system", "content": system_prefix + system_message}]
|
291 |
-
|
292 |
-
if history:
|
293 |
-
for user_msg, assistant_msg in history:
|
294 |
-
messages.append({"role": "user", "content": user_msg})
|
295 |
-
messages.append({"role": "assistant", "content": assistant_msg})
|
296 |
-
|
297 |
-
messages.append({"role": "user", "content": message})
|
298 |
-
|
299 |
-
partial_message = ""
|
300 |
-
|
301 |
-
for response in model_manager.generate_response(
|
302 |
-
messages,
|
303 |
-
max_tokens=max_tokens,
|
304 |
-
temperature=temperature,
|
305 |
-
top_p=top_p
|
306 |
-
):
|
307 |
-
token = response.choices[0].delta.get('content', '')
|
308 |
-
if token:
|
309 |
-
partial_message += token
|
310 |
-
current_history = history + [[message, partial_message]]
|
311 |
-
yield "", current_history
|
312 |
-
|
313 |
-
chat_history.add_conversation(message, partial_message)
|
314 |
-
|
315 |
-
except Exception as e:
|
316 |
-
error_msg = f"โ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค: {str(e)}"
|
317 |
-
chat_history.add_conversation(message, error_msg)
|
318 |
-
yield "", history + [[message, error_msg]]
|
319 |
-
|
320 |
-
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", title="GiniGEN ๐ค") as demo:
|
321 |
-
initial_history = chat_history.format_for_display()
|
322 |
-
with gr.Row():
|
323 |
-
with gr.Column(scale=2):
|
324 |
-
chatbot = gr.Chatbot(
|
325 |
-
value=initial_history,
|
326 |
-
height=600,
|
327 |
-
label="๋ํ์ฐฝ ๐ฌ",
|
328 |
-
show_label=True
|
329 |
-
)
|
330 |
-
|
331 |
-
msg = gr.Textbox(
|
332 |
-
label="๋ฉ์์ง ์
๋ ฅ",
|
333 |
-
show_label=False,
|
334 |
-
placeholder="๋ฌด์์ด๋ ๋ฌผ์ด๋ณด์ธ์... ๐ญ",
|
335 |
-
container=False
|
336 |
-
)
|
337 |
-
with gr.Row():
|
338 |
-
clear = gr.ClearButton([msg, chatbot], value="๋ํ๋ด์ฉ ์ง์ฐ๊ธฐ")
|
339 |
-
send = gr.Button("๋ณด๋ด๊ธฐ ๐ค")
|
340 |
-
|
341 |
-
with gr.Column(scale=1):
|
342 |
-
gr.Markdown("### GiniGEN ๐ค [ํ์ผ ์
๋ก๋] ๐\n์ง์ ํ์: ํ
์คํธ, ์ฝ๋, CSV, Parquet ํ์ผ")
|
343 |
-
file_upload = gr.File(
|
344 |
-
label="ํ์ผ ์ ํ",
|
345 |
-
file_types=["text", ".csv", ".parquet"],
|
346 |
-
type="filepath"
|
347 |
-
)
|
348 |
-
|
349 |
-
with gr.Accordion("๊ณ ๊ธ ์ค์ โ๏ธ", open=False):
|
350 |
-
system_message = gr.Textbox(label="์์คํ
๋ฉ์์ง ๐", value="")
|
351 |
-
max_tokens = gr.Slider(minimum=1, maximum=8000, value=4000, label="์ต๋ ํ ํฐ ์ ๐")
|
352 |
-
temperature = gr.Slider(minimum=0, maximum=1, value=0.7, label="์ฐฝ์์ฑ ์์ค ๐ก๏ธ")
|
353 |
-
top_p = gr.Slider(minimum=0, maximum=1, value=0.9, label="์๋ต ๋ค์์ฑ ๐")
|
354 |
-
|
355 |
-
gr.Examples(
|
356 |
examples=[
|
357 |
-
["
|
358 |
-
["
|
359 |
-
["
|
360 |
-
["
|
361 |
-
["
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
],
|
363 |
-
|
364 |
-
)
|
365 |
-
|
366 |
-
def clear_chat():
|
367 |
-
chat_history.clear_history()
|
368 |
-
return None, None
|
369 |
-
|
370 |
-
msg.submit(
|
371 |
-
chat,
|
372 |
-
inputs=[msg, chatbot, file_upload, system_message, max_tokens, temperature, top_p],
|
373 |
-
outputs=[msg, chatbot]
|
374 |
-
)
|
375 |
-
|
376 |
-
send.click(
|
377 |
-
chat,
|
378 |
-
inputs=[msg, chatbot, file_upload, system_message, max_tokens, temperature, top_p],
|
379 |
-
outputs=[msg, chatbot]
|
380 |
-
)
|
381 |
-
|
382 |
-
clear.click(
|
383 |
-
clear_chat,
|
384 |
-
outputs=[msg, chatbot]
|
385 |
-
)
|
386 |
-
|
387 |
-
file_upload.change(
|
388 |
-
lambda: "ํ์ผ ๋ถ์์ ์์ํฉ๋๋ค...",
|
389 |
-
outputs=msg
|
390 |
-
).then(
|
391 |
-
chat,
|
392 |
-
inputs=[msg, chatbot, file_upload, system_message, max_tokens, temperature, top_p],
|
393 |
-
outputs=[msg, chatbot]
|
394 |
)
|
395 |
|
396 |
if __name__ == "__main__":
|
397 |
-
demo.launch(
|
398 |
-
share=False,
|
399 |
-
show_error=True,
|
400 |
-
server_name="0.0.0.0",
|
401 |
-
server_port=7860,
|
402 |
-
max_threads=1
|
403 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import torch
|
2 |
+
import gradio as gr
|
3 |
import spaces
|
4 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
5 |
+
import os
|
6 |
from threading import Thread
|
7 |
+
import random
|
8 |
+
from datasets import load_dataset
|
9 |
|
10 |
+
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
|
|
11 |
MODEL_ID = "CohereForAI/c4ai-command-r7b-12-2024"
|
12 |
+
MODELS = os.environ.get("MODELS")
|
13 |
+
MODEL_NAME = MODEL_ID.split("/")[-1]
|
14 |
+
|
15 |
+
TITLE = "<h1><center>์๋ก์ด ์ผ๋ณธ์ด LLM ๋ชจ๋ธ ์น UI</center></h1>"
|
16 |
+
|
17 |
+
DESCRIPTION = f"""
|
18 |
+
<h3>๋ชจ๋ธ: <a href="https://huggingface.co/CohereForAI/c4ai-command-r7b-12-2024">CohereForAI/c4ai-command-r7b-12-2024</a></h3>
|
19 |
+
<center>
|
20 |
+
<p>
|
21 |
+
<br>
|
22 |
+
cc-by-nc
|
23 |
+
</p>
|
24 |
+
</center>
|
25 |
+
"""
|
26 |
+
|
27 |
+
CSS = """
|
28 |
+
.duplicate-button {
|
29 |
+
margin: auto !important;
|
30 |
+
color: white !important;
|
31 |
+
background: black !important;
|
32 |
+
border-radius: 100vh !important;
|
33 |
+
}
|
34 |
+
h3 {
|
35 |
+
text-align: center;
|
36 |
+
}
|
37 |
+
.chatbox .messages .message.user {
|
38 |
+
background-color: #e1f5fe;
|
39 |
+
}
|
40 |
+
.chatbox .messages .message.bot {
|
41 |
+
background-color: #eeeeee;
|
42 |
+
}
|
43 |
+
"""
|
44 |
+
|
45 |
+
# ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ก๋
|
46 |
+
model = AutoModelForCausalLM.from_pretrained(
|
47 |
+
MODEL_ID,
|
48 |
+
torch_dtype=torch.bfloat16,
|
49 |
+
device_map="auto",
|
50 |
+
)
|
51 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
52 |
+
|
53 |
+
# ๋ฐ์ดํฐ์
๋ก๋
|
54 |
+
dataset = load_dataset("elyza/ELYZA-tasks-100")
|
55 |
+
print(dataset)
|
56 |
+
|
57 |
+
split_name = "train" if "train" in dataset else "test"
|
58 |
+
examples_list = list(dataset[split_name])
|
59 |
+
examples = random.sample(examples_list, 50)
|
60 |
+
example_inputs = [[example['input']] for example in examples]
|
61 |
+
|
62 |
+
@spaces.GPU
|
63 |
+
def stream_chat(message: str, history: list, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
|
64 |
+
print(f'message is - {message}')
|
65 |
+
print(f'history is - {history}')
|
66 |
+
conversation = []
|
67 |
+
for prompt, answer in history:
|
68 |
+
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
69 |
+
conversation.append({"role": "user", "content": message})
|
70 |
+
|
71 |
+
input_ids = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
|
72 |
+
inputs = tokenizer(input_ids, return_tensors="pt").to(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
75 |
+
|
76 |
+
generate_kwargs = dict(
|
77 |
+
inputs,
|
78 |
+
streamer=streamer,
|
79 |
+
top_k=top_k,
|
80 |
+
top_p=top_p,
|
81 |
+
repetition_penalty=penalty,
|
82 |
+
max_new_tokens=max_new_tokens,
|
83 |
+
do_sample=True,
|
84 |
+
temperature=temperature,
|
85 |
+
eos_token_id=[255001],
|
86 |
+
)
|
87 |
|
88 |
+
thread = Thread(target=model.generate, kwargs=generate_kwargs)
|
89 |
+
thread.start()
|
90 |
+
|
91 |
+
buffer = ""
|
92 |
+
for new_text in streamer:
|
93 |
+
buffer += new_text
|
94 |
+
yield buffer
|
95 |
+
|
96 |
+
chatbot = gr.Chatbot(height=500)
|
97 |
+
|
98 |
+
with gr.Blocks(css=CSS) as demo:
|
99 |
+
gr.HTML(TITLE)
|
100 |
+
gr.HTML(DESCRIPTION)
|
101 |
+
gr.ChatInterface(
|
102 |
+
fn=stream_chat,
|
103 |
+
chatbot=chatbot,
|
104 |
+
fill_height=True,
|
105 |
+
theme="soft",
|
106 |
+
additional_inputs_accordion=gr.Accordion(label="โ๏ธ ๋งค๊ฐ๋ณ์", open=False, render=False),
|
107 |
+
additional_inputs=[
|
108 |
+
gr.Slider(
|
109 |
+
minimum=0,
|
110 |
+
maximum=1,
|
111 |
+
step=0.1,
|
112 |
+
value=0.8,
|
113 |
+
label="์จ๋",
|
114 |
+
render=False,
|
115 |
+
),
|
116 |
+
gr.Slider(
|
117 |
+
minimum=128,
|
118 |
+
maximum=1000000,
|
119 |
+
step=1,
|
120 |
+
value=100000,
|
121 |
+
label="์ต๋ ํ ํฐ ์",
|
122 |
+
render=False,
|
123 |
+
),
|
124 |
+
gr.Slider(
|
125 |
+
minimum=0.0,
|
126 |
+
maximum=1.0,
|
127 |
+
step=0.1,
|
128 |
+
value=0.8,
|
129 |
+
label="์์ ํ๋ฅ ",
|
130 |
+
render=False,
|
131 |
+
),
|
132 |
+
gr.Slider(
|
133 |
+
minimum=1,
|
134 |
+
maximum=20,
|
135 |
+
step=1,
|
136 |
+
value=20,
|
137 |
+
label="์์ K",
|
138 |
+
render=False,
|
139 |
+
),
|
140 |
+
gr.Slider(
|
141 |
+
minimum=0.0,
|
142 |
+
maximum=2.0,
|
143 |
+
step=0.1,
|
144 |
+
value=1.0,
|
145 |
+
label="๋ฐ๋ณต ํจ๋ํฐ",
|
146 |
+
render=False,
|
147 |
+
),
|
148 |
+
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
examples=[
|
150 |
+
["์์ด์ ์ฌ๋ฆ๋ฐฉํ ๊ณผํ ํ๋ก์ ํธ๋ฅผ ์ํ 5๊ฐ์ง ์์ด๋์ด๋ฅผ ์ฃผ์ธ์."],
|
151 |
+
["๋งํฌ๋ค์ด์ ์ฌ์ฉํ์ฌ ๋ธ๋ ์ดํฌ์์ ๊ฒ์ ๋ง๋ค๊ธฐ ํํ ๋ฆฌ์ผ์ ์์ฑํด์ฃผ์ธ์."],
|
152 |
+
["์ด๋ฅ๋ ฅ์ ๊ฐ์ง ์ฃผ์ธ๊ณต์ SF ์ด์ผ๊ธฐ ์๋๋ฆฌ์ค๋ฅผ ์์ฑํด์ฃผ์ธ์. ๋ณต์ ์ค์ , ํ
๋ง์ ๋ก๊ทธ๋ผ์ธ์ ๋
ผ๋ฆฌ์ ์ผ๋ก ์ฌ์ฉํด์ฃผ์ธ์"],
|
153 |
+
["์์ด์ ์ฌ๋ฆ๋ฐฉํ ์์ ์ฐ๊ตฌ๋ฅผ ์ํ 5๊ฐ์ง ์์ด๋์ด์ ๊ทธ ๋ฐฉ๋ฒ์ ๊ฐ๋จํ ์๋ ค์ฃผ์ธ์."],
|
154 |
+
["ํผ์ฆ ๊ฒ์ ์คํฌ๋ฆฝํธ ์์ฑ์ ์ํ ์กฐ์ธ ๋ถํ๋๋ฆฝ๋๋ค"],
|
155 |
+
["๋งํฌ๋ค์ด ํ์์ผ๋ก ๋ธ๋ก ๊นจ๊ธฐ ๊ฒ์ ์ ์ ๊ต๊ณผ์๋ฅผ ์์ฑํด์ฃผ์ธ์"],
|
156 |
+
["์ค๋ฒ ๅทๆณ๋ฅผ ์๊ฐํด์ฃผ์ธ์"],
|
157 |
+
["์ผ๋ณธ์ด ๊ด์ฉ๊ตฌ, ์๋ด์ ๊ดํ ์ํ ๋ฌธ์ ๋ฅผ ๋ง๋ค์ด์ฃผ์ธ์"],
|
158 |
+
["๋๋ผ์๋ชฝ์ ๋ฑ์ฅ์ธ๋ฌผ์ ์๋ ค์ฃผ์ธ์"],
|
159 |
+
["์ค์ฝ๋
ธ๋ฏธ์ผํค ๋ง๋๋ ๋ฐฉ๋ฒ์ ์๋ ค์ฃผ์ธ์"],
|
160 |
+
["๋ฌธ์ 9.11๊ณผ 9.9 ์ค ์ด๋ ๊ฒ์ด ๋ ํฐ๊ฐ์? step by step์ผ๋ก ๋
ผ๋ฆฌ์ ์ผ๋ก ์๊ฐํด์ฃผ์ธ์."],
|
161 |
],
|
162 |
+
cache_examples=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
)
|
164 |
|
165 |
if __name__ == "__main__":
|
166 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|