Spaces:
Sleeping
Sleeping
khaled5321
commited on
Commit
•
5e61ae1
1
Parent(s):
0752cab
Update app.py
Browse files
app.py
CHANGED
@@ -18,12 +18,9 @@ image_processor = AutoImageProcessor.from_pretrained(
|
|
18 |
def upload_image():
|
19 |
# Get the image file from the request
|
20 |
image_file = request.files['image']
|
21 |
-
|
22 |
-
# Save the image file to a desired location on the server
|
23 |
-
# image_path = "assets/"
|
24 |
-
# image_file.save(os.path.join('/', 'img.jpg'))
|
25 |
|
26 |
-
image = Image.open(BytesIO(image_file.read()))
|
|
|
27 |
inputs = image_processor(image, return_tensors="pt")
|
28 |
|
29 |
with torch.no_grad():
|
@@ -37,18 +34,10 @@ def upload_image():
|
|
37 |
# You can perform additional operations with the image here
|
38 |
# ...
|
39 |
|
40 |
-
# return "Image uploaded successfully"
|
41 |
return disease
|
42 |
|
43 |
|
44 |
|
45 |
-
@app.route('/get_text', methods=['GET'])
|
46 |
-
def get_text():
|
47 |
-
# image = Image.open('/img.jpg')
|
48 |
-
return
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
@app.route('/', methods=['GET'])
|
53 |
def hi():
|
54 |
return "Hello world"
|
|
|
18 |
def upload_image():
|
19 |
# Get the image file from the request
|
20 |
image_file = request.files['image']
|
|
|
|
|
|
|
|
|
21 |
|
22 |
+
# image = Image.open(BytesIO(image_file.read()))
|
23 |
+
image = Image.open(image_file.stream)
|
24 |
inputs = image_processor(image, return_tensors="pt")
|
25 |
|
26 |
with torch.no_grad():
|
|
|
34 |
# You can perform additional operations with the image here
|
35 |
# ...
|
36 |
|
|
|
37 |
return disease
|
38 |
|
39 |
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
@app.route('/', methods=['GET'])
|
42 |
def hi():
|
43 |
return "Hello world"
|