smyu commited on
Commit
fed4ed2
·
1 Parent(s): c394741

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -9,11 +9,13 @@ model = VisionEncoderDecoderModel.from_pretrained("ericvo/scribbl-scan-trocr")
9
  # load image examples
10
  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',
11
  'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRNYtTuSBpZPV_nkBYPMFwVVD9asZOPgHww4epu9EqWgDmXW--sE2o8og40ZfDGo87j5w&usqp=CAU']
12
- for idx, url in enumerate(urls):
13
- image = Image.open(requests.get(url, stream=True).raw)
14
- image.save(f"image_{idx}.png")
15
 
16
- def process_image(image):
 
 
17
  # prepare image
18
  pixel_values = processor(image, return_tensors="pt").pixel_values
19
 
 
9
  # load image examples
10
  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',
11
  'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRNYtTuSBpZPV_nkBYPMFwVVD9asZOPgHww4epu9EqWgDmXW--sE2o8og40ZfDGo87j5w&usqp=CAU']
12
+ # for idx, url in enumerate(urls):
13
+ # image = Image.open(requests.get(url, stream=True).raw)
14
+ # image.save(f"image_{idx}.png")
15
 
16
+ def process_image(image2):
17
+ image = Image.open(requests.get(image2, stream=True).raw)
18
+ image.save(f"image_{idx}.png")
19
  # prepare image
20
  pixel_values = processor(image, return_tensors="pt").pixel_values
21