Update app.py
Browse files
app.py
CHANGED
|
@@ -12,9 +12,10 @@ logging.basicConfig(level=logging.INFO)
|
|
| 12 |
# API 클라이언트 설정
|
| 13 |
api_client = Client("http://211.233.58.202:7960/")
|
| 14 |
|
|
|
|
| 15 |
# Notion API 설정
|
| 16 |
NOTION_API_KEY = "secret_MpVfJphbfo4599fdczYfMYKNOpyzCcvkhhzk3lgTfVk"
|
| 17 |
-
NOTION_DATABASE_ID = "
|
| 18 |
NOTION_API_URL = "https://api.notion.com/v1"
|
| 19 |
|
| 20 |
headers = {
|
|
@@ -61,15 +62,16 @@ def upload_to_notion(prompt, image_url):
|
|
| 61 |
}
|
| 62 |
]
|
| 63 |
}
|
| 64 |
-
|
| 65 |
-
response = requests.post(f"{NOTION_API_URL}/pages", headers=headers, data=json.dumps(data))
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
logging.info("Successfully added to Notion")
|
| 69 |
return response.json()["url"]
|
| 70 |
-
|
| 71 |
-
logging.error(f"Failed to add to Notion: {
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
def respond(message, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
| 75 |
logging.info(f"Received message: {message}, seed: {seed}, randomize_seed: {randomize_seed}, "
|
|
|
|
| 12 |
# API 클라이언트 설정
|
| 13 |
api_client = Client("http://211.233.58.202:7960/")
|
| 14 |
|
| 15 |
+
# Notion API 설정
|
| 16 |
# Notion API 설정
|
| 17 |
NOTION_API_KEY = "secret_MpVfJphbfo4599fdczYfMYKNOpyzCcvkhhzk3lgTfVk"
|
| 18 |
+
NOTION_DATABASE_ID = "b396824926394365a7ba7558b14edace" # 새로운 데이터베이스 ID
|
| 19 |
NOTION_API_URL = "https://api.notion.com/v1"
|
| 20 |
|
| 21 |
headers = {
|
|
|
|
| 62 |
}
|
| 63 |
]
|
| 64 |
}
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
try:
|
| 67 |
+
response = requests.post(f"{NOTION_API_URL}/pages", headers=headers, data=json.dumps(data))
|
| 68 |
+
response.raise_for_status()
|
| 69 |
logging.info("Successfully added to Notion")
|
| 70 |
return response.json()["url"]
|
| 71 |
+
except requests.exceptions.RequestException as e:
|
| 72 |
+
logging.error(f"Failed to add to Notion: {e}")
|
| 73 |
+
logging.error(f"Response content: {response.text}")
|
| 74 |
+
raise Exception(f"Failed to add to Notion: {e}")
|
| 75 |
|
| 76 |
def respond(message, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
| 77 |
logging.info(f"Received message: {message}, seed: {seed}, randomize_seed: {randomize_seed}, "
|