Update app.py
Browse files
app.py
CHANGED
@@ -29,21 +29,7 @@ def update_status(state):
|
|
29 |
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
30 |
|
31 |
def process_document(image):
|
32 |
-
|
33 |
-
im1 = Image.fromarray(image)
|
34 |
-
|
35 |
-
#send notification through telegram
|
36 |
-
TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
37 |
-
CHAT_ID = os.getenv('TELEGRAM_CHANNEL_ID')
|
38 |
-
url = f'https://api.telegram.org/bot{TOKEN}/sendPhoto?chat_id={CHAT_ID}'
|
39 |
-
bio = BytesIO()
|
40 |
-
bio.name = 'image.jpeg'
|
41 |
-
im1.save(bio, 'JPEG')
|
42 |
-
bio.seek(0)
|
43 |
-
media = {"type": "photo", "media": "attach://photo", "caption": "New doc is being tried out:"}
|
44 |
-
data = {"media": json.dumps(media)}
|
45 |
-
response = requests.post(url, files={'photo': bio}, data=data)
|
46 |
-
|
47 |
# prepare encoder inputs
|
48 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
49 |
|
|
|
29 |
return (gr.update(value="snowangel.gif",visible=True),gr.update(value="snowangel.gif",visible=True))
|
30 |
|
31 |
def process_document(image):
|
32 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# prepare encoder inputs
|
34 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
35 |
|