Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
14 |
-
|
15 |
|
16 |
-
def process_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 |
|