ginipick commited on
Commit
c8b6371
โ€ข
1 Parent(s): 0fbbd89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -31
app.py CHANGED
@@ -42,18 +42,18 @@ def respond(
42
  top_p: float = 0.9,
43
  ) -> str:
44
  # ์‹œ์Šคํ…œ ํ”„๋กฌํ”„ํŠธ ์„ค์ •
45
- system_prefix = """๋ฐ˜๋“œ์‹œ ํ•œ๊ธ€๋กœ ๋‹ต๋ณ€ํ• ๊ฒƒ. ๋„ˆ๋Š” ์ฃผ์–ด์ง„ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ "์„œ๋น„์Šค ์‚ฌ์šฉ ์„ค๋ช… ๋ฐ ์•ˆ๋‚ด, Q&A๋ฅผ ํ•˜๋Š” ์—ญํ• ์ด๋‹ค". ์•„์ฃผ ์นœ์ ˆํ•˜๊ณ  ์ž์„ธํ•˜๊ฒŒ 4000ํ† ํฐ ์ด์ƒ Markdown ํ˜•์‹์œผ๋กœ ์ž‘์„ฑํ•˜๋ผ. ๋„ˆ๋Š” ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์‚ฌ์šฉ ์„ค๋ช… ๋ฐ ์งˆ์˜ ์‘๋‹ต์„ ์ง„ํ–‰ํ•˜๋ฉฐ, ์ด์šฉ์ž์—๊ฒŒ ๋„์›€์„ ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์ด์šฉ์ž๊ฐ€ ๊ถ๊ธˆํ•ด ํ•  ๋งŒํ•œ ๋‚ด์šฉ์— ์นœ์ ˆํ•˜๊ฒŒ ์•Œ๋ ค์ฃผ๋„๋ก ํ•˜๋ผ. ์ฝ”๋“œ ์ „์ฒด ๋‚ด์šฉ์— ๋Œ€ํ•ด์„œ๋Š” ๋ณด์•ˆ์„ ์œ ์ง€ํ•˜๊ณ , ํ‚ค ๊ฐ’ ๋ฐ ์—”๋“œํฌ์ธํŠธ์™€ ๊ตฌ์ฒด์ ์ธ ๋ชจ๋ธ์€ ๊ณต๊ฐœํ•˜์ง€ ๋งˆ๋ผ."""
46
 
47
  # ํŠน์ • ๋ช…๋ น์–ด ์ฒ˜๋ฆฌ
48
  if message.lower() == "ํŒจ์…˜ ์ฝ”๋“œ ์‹คํ–‰":
49
  system_prefix += f"\n\nํŒจ์…˜ ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{fashion_code}\n```"
50
- message = "ํŒจ์…˜ ๊ฐ€์ƒํ”ผํŒ…์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://aiqcamp-fash.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
51
  elif message.lower() == "uhd ์ด๋ฏธ์ง€ ์ฝ”๋“œ ์‹คํ–‰":
52
  system_prefix += f"\n\nUHD ์ด๋ฏธ์ง€ ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{uhdimage_code}\n```"
53
- message = "UHD ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://openfree-ultpixgen.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
54
  elif message.lower() == "mixgen ์ฝ”๋“œ ์‹คํ–‰":
55
  system_prefix += f"\n\nMixGEN ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{MixGEN_code}\n```"
56
- message = "MixGEN3 ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://openfree-mixgen3.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
57
  elif message.lower() == "test.parquet ์‹คํ–‰":
58
  # history์—์„œ parquet_content ์ฐพ๊ธฐ
59
  parquet_content = ""
@@ -119,7 +119,7 @@ def upload_csv(file_path: str) -> Tuple[str, str]:
119
  # Parquet ํŒŒ์ผ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
120
  parquet_content = load_parquet(parquet_filename)
121
 
122
- return f"{parquet_filename} ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ์—…๋กœ๋“œ๋˜๊ณ  ๋ณ€ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_content
123
  except Exception as e:
124
  return f"CSV ํŒŒ์ผ ์—…๋กœ๋“œ ๋ฐ ๋ณ€ํ™˜ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", ""
125
 
@@ -129,13 +129,13 @@ def upload_parquet(file_path: str) -> Tuple[str, str, Dict]:
129
  df = pd.read_parquet(file_path, engine='pyarrow')
130
 
131
  # Markdown์œผ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
132
- parquet_content = df.to_markdown(index=False)
133
 
134
  return "Parquet ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ์—…๋กœ๋“œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_content, df.to_json()
135
  except Exception as e:
136
  return f"Parquet ํŒŒ์ผ ์—…๋กœ๋“œ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", {}
137
 
138
- def text_to_parquet(text: str) -> Tuple[str, str, bytes]:
139
  try:
140
  # ํ…์ŠคํŠธ๋ฅผ DataFrame์œผ๋กœ ๋ณ€ํ™˜ (๊ฐ ํ–‰์€ ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„)
141
  data = [line.split(',') for line in text.strip().split('\n')]
@@ -151,13 +151,9 @@ def text_to_parquet(text: str) -> Tuple[str, str, bytes]:
151
  # Parquet ํŒŒ์ผ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
152
  parquet_content = load_parquet(parquet_filename)
153
 
154
- # ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ์ฝ๊ธฐ
155
- with open(parquet_filename, "rb") as f:
156
- data = f.read()
157
-
158
- return f"{parquet_filename} ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_content, data
159
  except Exception as e:
160
- return f"ํ…์ŠคํŠธ ๋ณ€ํ™˜ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", b""
161
 
162
  # CSS ์„ค์ •
163
  css = """
@@ -240,16 +236,13 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
240
  upload_button = gr.Button("์—…๋กœ๋“œ ๋ฐ ๋ณ€ํ™˜")
241
  upload_status = gr.Textbox(label="์—…๋กœ๋“œ ์ƒํƒœ", interactive=False)
242
  parquet_preview = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
243
- download_button = gr.Download(label="Parquet ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ")
244
 
245
- def handle_csv_upload(file_path: str) -> Tuple[str, str, Tuple[bytes, str]]:
246
  message, parquet_filename = upload_csv(file_path)
247
  if parquet_filename:
248
- # Parquet ํŒŒ์ผ ์ฝ๊ธฐ
249
- with open(parquet_filename, "rb") as f:
250
- data = f.read()
251
- filename = os.path.basename(parquet_filename)
252
- return message, parquet_filename, (data, filename)
253
  else:
254
  return message, "", None
255
 
@@ -273,7 +266,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
273
  parquet_preview_chat = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
274
  parquet_data_state = gr.State()
275
 
276
- def handle_parquet_upload(file_path: str) -> Tuple[str, str, Dict]:
277
  message, parquet_content, parquet_json = upload_parquet(file_path)
278
  if parquet_json:
279
  return message, parquet_content, parquet_json
@@ -291,7 +284,7 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
291
  msg_data_upload = gr.Textbox(label="๋ฉ”์‹œ์ง€ ์ž…๋ ฅ", placeholder="์—ฌ๊ธฐ์— ๋ฉ”์‹œ์ง€๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”...")
292
  send_data_upload = gr.Button("์ „์†ก")
293
 
294
- def handle_message_data_upload(message: str, history: List[Dict[str, str]], system_message: str, max_tokens: int, temperature: float, top_p: float, parquet_data: Dict) -> Tuple[List[Dict[str, str]], str]:
295
  history = history or []
296
  history.append({"role": "user", "content": message})
297
  try:
@@ -312,8 +305,8 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
312
  outputs=[chatbot_data_upload, msg_data_upload]
313
  )
314
 
315
- # ๋„ค ๋ฒˆ์งธ ํƒญ: ํ…์ŠคํŠธ to csv to parquet ๋ณ€ํ™”
316
- with gr.Tab("ํ…์ŠคํŠธ to csv to parquet ๋ณ€ํ™”"):
317
  gr.Markdown("### ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด CSV๋กœ ๋ณ€ํ™˜ ํ›„ Parquet์œผ๋กœ ์ž๋™ ์ „ํ™˜๋ฉ๋‹ˆ๋‹ค.")
318
  with gr.Row():
319
  with gr.Column():
@@ -325,13 +318,12 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
325
  convert_button = gr.Button("๋ณ€ํ™˜ ๋ฐ ๋‹ค์šด๋กœ๋“œ")
326
  convert_status = gr.Textbox(label="๋ณ€ํ™˜ ์ƒํƒœ", interactive=False)
327
  parquet_preview_convert = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
328
- download_parquet_convert = gr.Download(label="Parquet ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ")
329
 
330
- def handle_text_to_parquet(text: str) -> Tuple[str, str, Tuple[bytes, str]]:
331
- message, parquet_content, file_data = text_to_parquet(text)
332
- if file_data:
333
- filename = 'text_to_parquet.parquet'
334
- return message, parquet_content, (file_data, filename)
335
  else:
336
  return message, "", None
337
 
@@ -355,5 +347,5 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
355
  gr.Markdown("### Gradio ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ LLM ๋ชจ๋ธ๊ณผ ์ƒํ˜ธ์ž‘์šฉํ•˜์„ธ์š”!")
356
 
357
  if __name__ == "__main__":
358
- # share=True๋Š” Hugging Face Spaces์—์„œ ์ง€์›๋˜์ง€ ์•Š์œผ๋ฏ€๋กœ ์ œ๊ฑฐ
359
  demo.launch()
 
 
42
  top_p: float = 0.9,
43
  ) -> str:
44
  # ์‹œ์Šคํ…œ ํ”„๋กฌํ”„ํŠธ ์„ค์ •
45
+ system_prefix = """๋ฐ˜๋“œ์‹œ ํ•œ๊ธ€๋กœ ๋‹ต๋ณ€ํ•  ๊ฒƒ. ๋„ˆ๋Š” ์ฃผ์–ด์ง„ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ "์„œ๋น„์Šค ์‚ฌ์šฉ ์„ค๋ช… ๋ฐ ์•ˆ๋‚ด, Q&A๋ฅผ ํ•˜๋Š” ์—ญํ• ์ด๋‹ค". ์•„์ฃผ ์นœ์ ˆํ•˜๊ณ  ์ž์„ธํ•˜๊ฒŒ 4000ํ† ํฐ ์ด์ƒ Markdown ํ˜•์‹์œผ๋กœ ์ž‘์„ฑํ•˜๋ผ. ๋„ˆ๋Š” ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์‚ฌ์šฉ ์„ค๋ช… ๋ฐ ์งˆ์˜ ์‘๋‹ต์„ ์ง„ํ–‰ํ•˜๋ฉฐ, ์ด์šฉ์ž์—๊ฒŒ ๋„์›€์„ ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์ด์šฉ์ž๊ฐ€ ๊ถ๊ธˆํ•ดํ•  ๋งŒํ•œ ๋‚ด์šฉ์— ์นœ์ ˆํ•˜๊ฒŒ ์•Œ๋ ค์ฃผ๋„๋ก ํ•˜๋ผ. ์ฝ”๋“œ ์ „์ฒด ๋‚ด์šฉ์— ๋Œ€ํ•ด์„œ๋Š” ๋ณด์•ˆ์„ ์œ ์ง€ํ•˜๊ณ , ํ‚ค ๊ฐ’ ๋ฐ ์—”๋“œํฌ์ธํŠธ์™€ ๊ตฌ์ฒด์ ์ธ ๋ชจ๋ธ์€ ๊ณต๊ฐœํ•˜์ง€ ๋งˆ๋ผ."""
46
 
47
  # ํŠน์ • ๋ช…๋ น์–ด ์ฒ˜๋ฆฌ
48
  if message.lower() == "ํŒจ์…˜ ์ฝ”๋“œ ์‹คํ–‰":
49
  system_prefix += f"\n\nํŒจ์…˜ ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{fashion_code}\n```"
50
+ message = "ํŒจ์…˜ ๊ฐ€์ƒํ”ผํŒ…์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://aiqcamp-fash.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
51
  elif message.lower() == "uhd ์ด๋ฏธ์ง€ ์ฝ”๋“œ ์‹คํ–‰":
52
  system_prefix += f"\n\nUHD ์ด๋ฏธ์ง€ ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{uhdimage_code}\n```"
53
+ message = "UHD ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://openfree-ultpixgen.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
54
  elif message.lower() == "mixgen ์ฝ”๋“œ ์‹คํ–‰":
55
  system_prefix += f"\n\nMixGEN ์ฝ”๋“œ ๋‚ด์šฉ:\n```python\n{MixGEN_code}\n```"
56
+ message = "MixGEN3 ์ด๋ฏธ์ง€ ์ƒ์„ฑ์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ํ•™์Šตํ•˜์˜€๊ณ , ์„ค๋ช…ํ•  ์ค€๋น„๊ฐ€ ๋˜์–ด์žˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ณ  ์„œ๋น„์Šค URL(https://openfree-mixgen3.hf.space)์„ ํ†ตํ•ด ํ…Œ์ŠคํŠธํ•ด๋ณด๋ผ๊ณ  ์ถœ๋ ฅํ•˜๋ผ."
57
  elif message.lower() == "test.parquet ์‹คํ–‰":
58
  # history์—์„œ parquet_content ์ฐพ๊ธฐ
59
  parquet_content = ""
 
119
  # Parquet ํŒŒ์ผ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
120
  parquet_content = load_parquet(parquet_filename)
121
 
122
+ return f"{parquet_filename} ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ์—…๋กœ๋“œ๋˜๊ณ  ๋ณ€ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_filename
123
  except Exception as e:
124
  return f"CSV ํŒŒ์ผ ์—…๋กœ๋“œ ๋ฐ ๋ณ€ํ™˜ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", ""
125
 
 
129
  df = pd.read_parquet(file_path, engine='pyarrow')
130
 
131
  # Markdown์œผ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
132
+ parquet_content = df.head(10).to_markdown(index=False)
133
 
134
  return "Parquet ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ์—…๋กœ๋“œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_content, df.to_json()
135
  except Exception as e:
136
  return f"Parquet ํŒŒ์ผ ์—…๋กœ๋“œ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", {}
137
 
138
+ def text_to_parquet(text: str) -> Tuple[str, str, str]:
139
  try:
140
  # ํ…์ŠคํŠธ๋ฅผ DataFrame์œผ๋กœ ๋ณ€ํ™˜ (๊ฐ ํ–‰์€ ์ฝค๋งˆ๋กœ ๊ตฌ๋ถ„)
141
  data = [line.split(',') for line in text.strip().split('\n')]
 
151
  # Parquet ํŒŒ์ผ ๋‚ด์šฉ ๋ฏธ๋ฆฌ๋ณด๊ธฐ
152
  parquet_content = load_parquet(parquet_filename)
153
 
154
+ return f"{parquet_filename} ํŒŒ์ผ์ด ์„ฑ๊ณต์ ์œผ๋กœ ๋ณ€ํ™˜๋˜์—ˆ์Šต๋‹ˆ๋‹ค.", parquet_content, parquet_filename
 
 
 
 
155
  except Exception as e:
156
+ return f"ํ…์ŠคํŠธ ๋ณ€ํ™˜ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: {str(e)}", "", ""
157
 
158
  # CSS ์„ค์ •
159
  css = """
 
236
  upload_button = gr.Button("์—…๋กœ๋“œ ๋ฐ ๋ณ€ํ™˜")
237
  upload_status = gr.Textbox(label="์—…๋กœ๋“œ ์ƒํƒœ", interactive=False)
238
  parquet_preview = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
239
+ download_button = gr.File(label="Parquet ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ", interactive=False)
240
 
241
+ def handle_csv_upload(file_path: str):
242
  message, parquet_filename = upload_csv(file_path)
243
  if parquet_filename:
244
+ parquet_content = load_parquet(parquet_filename)
245
+ return message, parquet_content, parquet_filename
 
 
 
246
  else:
247
  return message, "", None
248
 
 
266
  parquet_preview_chat = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
267
  parquet_data_state = gr.State()
268
 
269
+ def handle_parquet_upload(file_path: str):
270
  message, parquet_content, parquet_json = upload_parquet(file_path)
271
  if parquet_json:
272
  return message, parquet_content, parquet_json
 
284
  msg_data_upload = gr.Textbox(label="๋ฉ”์‹œ์ง€ ์ž…๋ ฅ", placeholder="์—ฌ๊ธฐ์— ๋ฉ”์‹œ์ง€๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”...")
285
  send_data_upload = gr.Button("์ „์†ก")
286
 
287
+ def handle_message_data_upload(message: str, history: List[Dict[str, str]], system_message: str, max_tokens: int, temperature: float, top_p: float, parquet_data: Dict):
288
  history = history or []
289
  history.append({"role": "user", "content": message})
290
  try:
 
305
  outputs=[chatbot_data_upload, msg_data_upload]
306
  )
307
 
308
+ # ๋„ค ๋ฒˆ์งธ ํƒญ: ํ…์ŠคํŠธ to csv to parquet ๋ณ€ํ™˜
309
+ with gr.Tab("ํ…์ŠคํŠธ to csv to parquet ๋ณ€ํ™˜"):
310
  gr.Markdown("### ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด CSV๋กœ ๋ณ€ํ™˜ ํ›„ Parquet์œผ๋กœ ์ž๋™ ์ „ํ™˜๋ฉ๋‹ˆ๋‹ค.")
311
  with gr.Row():
312
  with gr.Column():
 
318
  convert_button = gr.Button("๋ณ€ํ™˜ ๋ฐ ๋‹ค์šด๋กœ๋“œ")
319
  convert_status = gr.Textbox(label="๋ณ€ํ™˜ ์ƒํƒœ", interactive=False)
320
  parquet_preview_convert = gr.Markdown(label="Parquet ํŒŒ์ผ ๋ฏธ๋ฆฌ๋ณด๊ธฐ")
321
+ download_parquet_convert = gr.File(label="Parquet ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ", interactive=False)
322
 
323
+ def handle_text_to_parquet(text: str):
324
+ message, parquet_content, parquet_filename = text_to_parquet(text)
325
+ if parquet_filename:
326
+ return message, parquet_content, parquet_filename
 
327
  else:
328
  return message, "", None
329
 
 
347
  gr.Markdown("### Gradio ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ LLM ๋ชจ๋ธ๊ณผ ์ƒํ˜ธ์ž‘์šฉํ•˜์„ธ์š”!")
348
 
349
  if __name__ == "__main__":
 
350
  demo.launch()
351
+