cutechicken commited on
Commit
afed118
โ€ข
1 Parent(s): 6adfca3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -28
app.py CHANGED
@@ -591,45 +591,41 @@ with gr.Blocks(css=CSS) as demo:
591
  gr.Examples(
592
  examples=[
593
  ["๋‹ค์Œ ์ฝ”๋“œ์˜ ๋ฌธ์ œ์ ์„ ์ฐพ์•„๋‚ด๊ณ  ๊ฐœ์„ ๋œ ๋ฒ„์ „์„ ์ œ์‹œํ•ด์ฃผ์„ธ์š”:\ndef fibonacci(n):\n if n <= 1: return n\n return fibonacci(n-1) + fibonacci(n-2)"],
594
- ["์–‘์ž์—ญํ•™์˜ ์Šˆ๋ขฐ๋”ฉ๊ฑฐ ๋ฐฉ์ •์‹๊ณผ ํ•˜์ด์  ๋ฒ ๋ฅดํฌ์˜ ๋ถˆํ™•์ •์„ฑ ์›๋ฆฌ์˜ ๊ด€๊ณ„๋ฅผ ์‰ฝ๊ฒŒ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”."],
595
  ["๋‹ค์Œ ์˜์–ด ๋ฌธ์žฅ์„ ํ•œ๊ตญ์–ด๋กœ ๋ฒˆ์—ญํ•˜๊ณ , ์–ดํœ˜์™€ ๋ฌธ๋ฒ•์  ํŠน์ง•์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”: 'The implementation of artificial intelligence in healthcare has revolutionized patient care, yet it raises ethical concerns regarding privacy and decision-making autonomy.'"],
596
  ["์ฃผ์–ด์ง„ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์„ํ•˜๊ณ  ์ธ์‚ฌ์ดํŠธ๋ฅผ ๋„์ถœํ•ด์ฃผ์„ธ์š”:\n์—ฐ๋„๋ณ„ ๋งค์ถœ์•ก(์–ต์›)\n2019: 1200\n2020: 980\n2021: 1450\n2022: 2100\n2023: 1890"],
597
  ["๋‹ค์Œ ์‹œ๋‚˜๋ฆฌ์˜ค์— ๋Œ€ํ•œ SWOT ๋ถ„์„์„ ํ•ด์ฃผ์„ธ์š”: '์ „ํ†ต์ ์ธ ์˜คํ”„๋ผ์ธ ์„œ์ ์ด ์˜จ๋ผ์ธ ํ”Œ๋žซํผ์œผ๋กœ์˜ ์ „ํ™˜์„ ๊ณ ๋ ค์ค‘์ž…๋‹ˆ๋‹ค. ๋…์ž๋“ค์˜ ๋””์ง€ํ„ธ ์ฝ˜ํ…์ธ  ์†Œ๋น„๊ฐ€ ์ฆ๊ฐ€ํ•˜๋Š” ์ƒํ™ฉ์—์„œ ๊ฒฝ์Ÿ๋ ฅ์„ ์œ ์ง€ํ•˜๋ฉด์„œ ๊ธฐ์กด ๊ณ ๊ฐ์ธต๋„ ์ง€ํ‚ค๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.'"],
598
- ["์ด ์ฒ ํ•™์  ์งˆ๋ฌธ์— ๋Œ€ํ•ด ๋‹ค์–‘ํ•œ ๊ด€์ ์—์„œ ๋…ผ๋ฆฌ์ ์œผ๋กœ ๋ถ„์„ํ•ด์ฃผ์„ธ์š”: '์ธ๊ณต์ง€๋Šฅ์ด ์˜์‹์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š”๊ฐ€? ์˜์‹์˜ ์ •์˜๋Š” ๋ฌด์—‡์ด๋ฉฐ, ๊ธฐ๊ณ„๊ฐ€ ๊ทธ๊ฒƒ์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋Š” ์กฐ๊ฑด์€ ๋ฌด์—‡์ธ๊ฐ€?'"],
599
  ["๋‹ค์Œ ์ˆ˜ํ•™ ๋ฌธ์ œ๋ฅผ ๋‹จ๊ณ„๋ณ„๋กœ ์ž์„ธํžˆ ํ’€์ดํ•ด์ฃผ์„ธ์š”: 'ํ•œ ์›์˜ ๋„“์ด๊ฐ€ ๊ทธ ์›์— ๋‚ด์ ‘ํ•˜๋Š” ์ •์‚ฌ๊ฐํ˜• ๋„“์ด์˜ 2๋ฐฐ์ผ ๋•Œ, ์›์˜ ๋ฐ˜์ง€๋ฆ„๊ณผ ์ •์‚ฌ๊ฐํ˜•์˜ ํ•œ ๋ณ€์˜ ๊ธธ์ด์˜ ๊ด€๊ณ„๋ฅผ ๊ตฌํ•˜์‹œ์˜ค.'"],
600
  ["๋‹ค์Œ SQL ์ฟผ๋ฆฌ๋ฅผ ์ตœ์ ํ™”ํ•˜๊ณ  ๊ฐœ์„ ์ ์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”:\nSELECT * FROM orders o\nLEFT JOIN customers c ON o.customer_id = c.id\nWHERE YEAR(o.order_date) = 2023\nAND c.country = 'Korea'\nORDER BY o.order_date DESC;"],
601
- ["ํ˜„๋Œ€ ๋ฌผ๋ฆฌํ•™์˜ ๊ฐ€์žฅ ํฐ ๋ฏธ์Šคํ„ฐ๋ฆฌ์ธ '์•”ํ‘ ๋ฌผ์งˆ'๊ณผ '์•”ํ‘ ์—๋„ˆ์ง€'์— ๋Œ€ํ•ด ์„ค๋ช…ํ•˜๊ณ , ์ด๋“ค์ด ์šฐ์ฃผ์˜ ๊ตฌ์กฐ์™€ ์ง„ํ™”์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ๋ถ„์„ํ•ด์ฃผ์„ธ์š”."],
602
  ["๋‹ค์Œ ๋งˆ์ผ€ํŒ… ์บ ํŽ˜์ธ์˜ ROI๋ฅผ ๋ถ„์„ํ•˜๊ณ  ๊ฐœ์„ ๋ฐฉ์•ˆ์„ ์ œ์‹œํ•ด์ฃผ์„ธ์š”:\n์ด ๋น„์šฉ: 5000๋งŒ์›\n๋„๋‹ฌ์ž ์ˆ˜: 100๋งŒ๋ช…\nํด๋ฆญ๋ฅ : 2.3%\n์ „ํ™˜์œจ: 0.8%\nํ‰๊ท  ๊ตฌ๋งค์•ก: 35,000์›"],
603
  ],
604
  inputs=msg
605
  )
606
-
607
 
 
 
 
 
 
 
608
 
609
- # ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ
610
- msg.submit(
611
- stream_chat,
612
- inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
613
- outputs=[msg, chatbot]
614
- )
615
-
616
- send.click(
617
- stream_chat,
618
- inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
619
- outputs=[msg, chatbot]
620
- )
621
-
622
- def init_msg():
623
- return "ํŒŒ์ผ ๋ถ„์„์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค..."
624
-
625
- file_upload.change(
626
- init_msg,
627
- outputs=msg
628
- ).then(
629
- stream_chat,
630
- inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
631
- outputs=[msg, chatbot]
632
- )
633
 
634
  if __name__ == "__main__":
635
  demo.launch()
 
591
  gr.Examples(
592
  examples=[
593
  ["๋‹ค์Œ ์ฝ”๋“œ์˜ ๋ฌธ์ œ์ ์„ ์ฐพ์•„๋‚ด๊ณ  ๊ฐœ์„ ๋œ ๋ฒ„์ „์„ ์ œ์‹œํ•ด์ฃผ์„ธ์š”:\ndef fibonacci(n):\n if n <= 1: return n\n return fibonacci(n-1) + fibonacci(n-2)"],
 
594
  ["๋‹ค์Œ ์˜์–ด ๋ฌธ์žฅ์„ ํ•œ๊ตญ์–ด๋กœ ๋ฒˆ์—ญํ•˜๊ณ , ์–ดํœ˜์™€ ๋ฌธ๋ฒ•์  ํŠน์ง•์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”: 'The implementation of artificial intelligence in healthcare has revolutionized patient care, yet it raises ethical concerns regarding privacy and decision-making autonomy.'"],
595
  ["์ฃผ์–ด์ง„ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์„ํ•˜๊ณ  ์ธ์‚ฌ์ดํŠธ๋ฅผ ๋„์ถœํ•ด์ฃผ์„ธ์š”:\n์—ฐ๋„๋ณ„ ๋งค์ถœ์•ก(์–ต์›)\n2019: 1200\n2020: 980\n2021: 1450\n2022: 2100\n2023: 1890"],
596
  ["๋‹ค์Œ ์‹œ๋‚˜๋ฆฌ์˜ค์— ๋Œ€ํ•œ SWOT ๋ถ„์„์„ ํ•ด์ฃผ์„ธ์š”: '์ „ํ†ต์ ์ธ ์˜คํ”„๋ผ์ธ ์„œ์ ์ด ์˜จ๋ผ์ธ ํ”Œ๋žซํผ์œผ๋กœ์˜ ์ „ํ™˜์„ ๊ณ ๋ ค์ค‘์ž…๋‹ˆ๋‹ค. ๋…์ž๋“ค์˜ ๋””์ง€ํ„ธ ์ฝ˜ํ…์ธ  ์†Œ๋น„๊ฐ€ ์ฆ๊ฐ€ํ•˜๋Š” ์ƒํ™ฉ์—์„œ ๊ฒฝ์Ÿ๋ ฅ์„ ์œ ์ง€ํ•˜๋ฉด์„œ ๊ธฐ์กด ๊ณ ๊ฐ์ธต๋„ ์ง€ํ‚ค๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค.'"],
 
597
  ["๋‹ค์Œ ์ˆ˜ํ•™ ๋ฌธ์ œ๋ฅผ ๋‹จ๊ณ„๋ณ„๋กœ ์ž์„ธํžˆ ํ’€์ดํ•ด์ฃผ์„ธ์š”: 'ํ•œ ์›์˜ ๋„“์ด๊ฐ€ ๊ทธ ์›์— ๋‚ด์ ‘ํ•˜๋Š” ์ •์‚ฌ๊ฐํ˜• ๋„“์ด์˜ 2๋ฐฐ์ผ ๋•Œ, ์›์˜ ๋ฐ˜์ง€๋ฆ„๊ณผ ์ •์‚ฌ๊ฐํ˜•์˜ ํ•œ ๋ณ€์˜ ๊ธธ์ด์˜ ๊ด€๊ณ„๋ฅผ ๊ตฌํ•˜์‹œ์˜ค.'"],
598
  ["๋‹ค์Œ SQL ์ฟผ๋ฆฌ๋ฅผ ์ตœ์ ํ™”ํ•˜๊ณ  ๊ฐœ์„ ์ ์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”:\nSELECT * FROM orders o\nLEFT JOIN customers c ON o.customer_id = c.id\nWHERE YEAR(o.order_date) = 2023\nAND c.country = 'Korea'\nORDER BY o.order_date DESC;"],
 
599
  ["๋‹ค์Œ ๋งˆ์ผ€ํŒ… ์บ ํŽ˜์ธ์˜ ROI๋ฅผ ๋ถ„์„ํ•˜๊ณ  ๊ฐœ์„ ๋ฐฉ์•ˆ์„ ์ œ์‹œํ•ด์ฃผ์„ธ์š”:\n์ด ๋น„์šฉ: 5000๋งŒ์›\n๋„๋‹ฌ์ž ์ˆ˜: 100๋งŒ๋ช…\nํด๋ฆญ๋ฅ : 2.3%\n์ „ํ™˜์œจ: 0.8%\nํ‰๊ท  ๊ตฌ๋งค์•ก: 35,000์›"],
600
  ],
601
  inputs=msg
602
  )
 
603
 
604
+ # ์ด๋ฒคํŠธ ๋ฐ”์ธ๋”ฉ
605
+ msg.submit(
606
+ stream_chat,
607
+ inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
608
+ outputs=[msg, chatbot]
609
+ )
610
 
611
+ send.click(
612
+ stream_chat,
613
+ inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
614
+ outputs=[msg, chatbot]
615
+ )
616
+
617
+ def init_msg():
618
+ return "ํŒŒ์ผ ๋ถ„์„์„ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค..."
619
+
620
+ # file_upload.change() ์ด๋ฒคํŠธ๋ฅผ ์—ฌ๊ธฐ๋กœ ์ด๋™
621
+ file_upload.change(
622
+ init_msg,
623
+ outputs=msg
624
+ ).then(
625
+ stream_chat,
626
+ inputs=[msg, chatbot, file_upload, temperature, max_new_tokens, top_p, top_k, penalty],
627
+ outputs=[msg, chatbot]
628
+ )
 
 
 
 
 
 
629
 
630
  if __name__ == "__main__":
631
  demo.launch()