wanda222 commited on
Commit
7468fde
ยท
verified ยท
1 Parent(s): ae11c94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -12,8 +12,8 @@ def parse_document(file):
12
  ์—…๋กœ๋“œ๋œ PDF ๋ฌธ์„œ๋ฅผ HTML๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ (Upstage Document Parse API ์‚ฌ์šฉ)
13
  """
14
  url = "https://api.upstage.ai/v1/document-ai/document-parse" # API URL
15
- headers = {'Authorization': f'Bearer {UPSTAGE_API_KEY}'} # ์ธ์ฆ ํ—ค๋”
16
- files = {"document": open(file.name, "rb")} # ํŒŒ์ผ ์—ด์–ด์„œ ๋ฐ”์ด๋„ˆ๋ฆฌ๋กœ ์ „๋‹ฌ
17
  data = {
18
  "base64_encoding": "['table']", # ํ…Œ์ด๋ธ”์€ base64๋กœ ์ธ์ฝ”๋”ฉ ์š”์ฒญ
19
  "model": "document-parse" # ์‚ฌ์šฉํ•  ๋ชจ๋ธ ์ง€์ •
@@ -64,7 +64,7 @@ def chat_with_document(history, html_text, user_question):
64
  response = client.chat.completions.create(
65
  model="solar-pro", # ์‚ฌ์šฉํ•  Solar LLM ๋ชจ๋ธ
66
  messages=messages, # ๊ตฌ์„ฑ๋œ ๋Œ€ํ™” ๋ฉ”์‹œ์ง€๋“ค
67
- temperature=0, # ์ฐฝ์˜์„ฑ ์ตœ์†Œํ™” (์ •ํ™•ํ•œ ๋‹ต๋ณ€ ์œ ๋„)
68
  max_tokens=1024 # ์ตœ๋Œ€ ์‘๋‹ต ๊ธธ์ด
69
  )
70
  bot_reply = response.choices[0].message.content # ์‘๋‹ต ํ…์ŠคํŠธ ์ถ”์ถœ
 
12
  ์—…๋กœ๋“œ๋œ PDF ๋ฌธ์„œ๋ฅผ HTML๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜ (Upstage Document Parse API ์‚ฌ์šฉ)
13
  """
14
  url = "https://api.upstage.ai/v1/document-ai/document-parse" # API URL
15
+ headers = {'Authorization': f'Bearer {UPSTAGE_API_KEY}'} # API Key ์ธ์ฆ ํ—ค๋”
16
+ files = {"document": open(file.name, "rb")} # ํŒŒ์ผ ์—ด์–ด์„œ ์ „๋‹ฌ
17
  data = {
18
  "base64_encoding": "['table']", # ํ…Œ์ด๋ธ”์€ base64๋กœ ์ธ์ฝ”๋”ฉ ์š”์ฒญ
19
  "model": "document-parse" # ์‚ฌ์šฉํ•  ๋ชจ๋ธ ์ง€์ •
 
64
  response = client.chat.completions.create(
65
  model="solar-pro", # ์‚ฌ์šฉํ•  Solar LLM ๋ชจ๋ธ
66
  messages=messages, # ๊ตฌ์„ฑ๋œ ๋Œ€ํ™” ๋ฉ”์‹œ์ง€๋“ค
67
+ temperature=0, # ์ฐฝ์˜์„ฑ ์ตœ์†Œํ™” (0~1)
68
  max_tokens=1024 # ์ตœ๋Œ€ ์‘๋‹ต ๊ธธ์ด
69
  )
70
  bot_reply = response.choices[0].message.content # ์‘๋‹ต ํ…์ŠคํŠธ ์ถ”์ถœ