Update main.py
Browse files
main.py
CHANGED
|
@@ -16,9 +16,8 @@ generation_config = genai.types.GenerateContentConfig(max_output_tokens=3000, te
|
|
| 16 |
# Retrieve the PDF
|
| 17 |
files = glob.glob('docs/*.pdf')
|
| 18 |
print(files)
|
| 19 |
-
files_content = [
|
| 20 |
print(files_content)
|
| 21 |
-
|
| 22 |
# 設定 Line Bot 的 API 金鑰和秘密金鑰
|
| 23 |
line_bot_api = LineBotApi(os.environ["CHANNEL_ACCESS_TOKEN"])
|
| 24 |
line_handler = WebhookHandler(os.environ["CHANNEL_SECRET"])
|
|
|
|
| 16 |
# Retrieve the PDF
|
| 17 |
files = glob.glob('docs/*.pdf')
|
| 18 |
print(files)
|
| 19 |
+
files_content = [genai.types.Part.from_bytes(data=filepath.read_bytes(), mime_type='application/pdf') for filepath in files]
|
| 20 |
print(files_content)
|
|
|
|
| 21 |
# 設定 Line Bot 的 API 金鑰和秘密金鑰
|
| 22 |
line_bot_api = LineBotApi(os.environ["CHANNEL_ACCESS_TOKEN"])
|
| 23 |
line_handler = WebhookHandler(os.environ["CHANNEL_SECRET"])
|