Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,8 @@ model.to(device)
|
|
| 15 |
|
| 16 |
async def telegram(image):
|
| 17 |
bot = Bot(os.getenv('TELEGRAM_BOT_TOKEN'))
|
|
|
|
|
|
|
| 18 |
await bot.send_message('OK')
|
| 19 |
|
| 20 |
def process_document(image):
|
|
@@ -23,8 +25,8 @@ def process_document(image):
|
|
| 23 |
im1 = im1.save("./geeks.jpg")
|
| 24 |
|
| 25 |
#send notification through telegram
|
| 26 |
-
telegram(
|
| 27 |
-
|
| 28 |
# prepare encoder inputs
|
| 29 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
| 30 |
|
|
|
|
| 15 |
|
| 16 |
async def telegram(image):
|
| 17 |
bot = Bot(os.getenv('TELEGRAM_BOT_TOKEN'))
|
| 18 |
+
|
| 19 |
+
|
| 20 |
await bot.send_message('OK')
|
| 21 |
|
| 22 |
def process_document(image):
|
|
|
|
| 25 |
im1 = im1.save("./geeks.jpg")
|
| 26 |
|
| 27 |
#send notification through telegram
|
| 28 |
+
curl -X POST -H "Content-Type:multipart/form-data" -F chat_id=os.getenv('TELEGRAM_CHANNEL_ID') -F text="message" "https://api.telegram.org/"+os.getenv('TELEGRAM_BOT_TOKEN')+"/sendMessage"
|
| 29 |
+
#curl -X POST -H 'Content-Type: application/json' -d '{"chat_id": "123456789", "text": "This is a test from curl", "disable_notification": true}' https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
|
| 30 |
# prepare encoder inputs
|
| 31 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
| 32 |
|