sivan22 commited on
Commit
8ea07b8
·
1 Parent(s): 4a49cfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -3,6 +3,13 @@ from transformers import VisionEncoderDecoderModel, AutoImageProcessor, BertTok
3
  import requests
4
  from PIL import Image
5
 
 
 
 
 
 
 
 
6
  image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-base-patch4-window7-224")
7
  tokenizer = tokenizer =BertTokenizerFast.from_pretrained("onlplab/alephbert-base")
8
  model = VisionEncoderDecoderModel.from_pretrained("sivan22/hdd-words-ocr")
 
3
  import requests
4
  from PIL import Image
5
 
6
+ urls = ['https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSoolxi9yWGAT5SLZShv8vVd0bz47UWRzQC19fDTeE8GmGv_Rn-PCF1pP1rrUx8kOjA4gg&usqp=CAU',
7
+ 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRNYtTuSBpZPV_nkBYPMFwVVD9asZOPgHww4epu9EqWgDmXW--sE2o8og40ZfDGo87j5w&usqp=CAU']
8
+ for idx, url in enumerate(urls):
9
+ image = Image.open(requests.get(url, stream=True).raw)
10
+ image.save(f"image_{idx}.png")
11
+
12
+
13
  image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-base-patch4-window7-224")
14
  tokenizer = tokenizer =BertTokenizerFast.from_pretrained("onlplab/alephbert-base")
15
  model = VisionEncoderDecoderModel.from_pretrained("sivan22/hdd-words-ocr")