Inigozr commited on
Commit
b55ac7c
·
1 Parent(s): 26194a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -20
app.py CHANGED
@@ -73,24 +73,4 @@ async def read_root():
73
 
74
  @app.get("/")
75
  async def read_root():
76
- # Download image content from URL
77
- image_url = "https://s1.eestatic.com/2018/04/10/actualidad/actualidad_298735505_130172549_1000x500.jpg"
78
- response = requests.get(image_url)
79
- response.raise_for_status()
80
-
81
- # Open the image using PIL
82
- image = Image.open(io.BytesIO(response.content))
83
- # Perform YOLO prediction
84
- predictions = predict_yolo(image_url)
85
-
86
- # Draw bounding boxes on the image
87
- image_np = np.array(image)
88
- image_with_boxes = draw_boxes(image_np, predictions)
89
-
90
- # Save the image with bounding boxes
91
- image_with_boxes_path = f"/tmp/{file.filename.split('.')[0]}_with_boxes.jpg"
92
- cv2.imwrite(image_with_boxes_path, cv2.cvtColor(image_with_boxes, cv2.COLOR_RGB2BGR))
93
-
94
- # Render the HTML with the image and bounding boxes
95
- return templates.TemplateResponse("prediction.html", {"request": file, "image_path": image_with_boxes_path})
96
  return {"message": "Hello, this is a YOLO prediction API using FastAPI!"}
 
73
 
74
  @app.get("/")
75
  async def read_root():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  return {"message": "Hello, this is a YOLO prediction API using FastAPI!"}