Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 # ์๋ต ํ
์คํธ ์ถ์ถ
|