Pezh commited on
Commit
d6a72d9
1 Parent(s): 461810f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -16
app.py CHANGED
@@ -1,24 +1,12 @@
1
- #import os
2
  import streamlit as st
3
- import requests
4
- from pdf2image import convert_from_bytes
5
 
6
- def download_pdf(url):
7
- response = requests.get(url)
8
- return response.content
9
-
10
- def convert_pdf_to_images(pdf_bytes):
11
- images = convert_from_bytes(pdf_bytes)
12
-
13
- #if not os.path.exists(output_folder):
14
- #os.makedirs(output_folder)
15
 
16
  for i, image in enumerate(images):
17
  image.save(f'image{i}.png')
18
 
19
- # Use the functions
20
- #url = 'http://example.com/path_to_your_pdf.pdf'
21
- #pdf_bytes = download_pdf(url)
22
- #output_folder = os.environ.get('HUGGINGFACE_CACHE', 'images')
23
  if st.button('ss'):
24
  convert_pdf_to_images('hoor.pdf')
 
 
1
  import streamlit as st
2
+ import os
3
+ from pdf2image import convert_from_path
4
 
5
+ def convert_pdf_to_images(pdf_path):
6
+ images = convert_from_path(pdf_path)
 
 
 
 
 
 
 
7
 
8
  for i, image in enumerate(images):
9
  image.save(f'image{i}.png')
10
 
 
 
 
 
11
  if st.button('ss'):
12
  convert_pdf_to_images('hoor.pdf')