Update app.py
Browse files
app.py
CHANGED
@@ -13,14 +13,17 @@ model = VisionEncoderDecoderModel.from_pretrained("./donut-base-finetuned-inv")
|
|
13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
14 |
model.to(device)
|
15 |
|
|
|
|
|
|
|
|
|
16 |
def process_document(image):
|
17 |
#save uploaded file locally
|
18 |
im1 = Image.fromarray(image)
|
19 |
im1 = im1.save("./geeks.jpg")
|
20 |
|
21 |
#send notification through telegram
|
22 |
-
|
23 |
-
await bot.send_message('OK')
|
24 |
|
25 |
# prepare encoder inputs
|
26 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
|
|
13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
14 |
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):
|
21 |
#save uploaded file locally
|
22 |
im1 = Image.fromarray(image)
|
23 |
im1 = im1.save("./geeks.jpg")
|
24 |
|
25 |
#send notification through telegram
|
26 |
+
telegram(image)
|
|
|
27 |
|
28 |
# prepare encoder inputs
|
29 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|