Devon12 commited on
Commit
882fc55
1 Parent(s): 5d1b970

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,7 +1,8 @@
1
-
2
  import gradio as gr
3
  import torch
4
  from ultralyticsplus import YOLO, render_result
 
 
5
 
6
  def yolov8_func(image,
7
  image_size,
@@ -21,9 +22,13 @@ def yolov8_func(image,
21
  print("Confidence: ", box.conf)
22
  print("Coordinates: ", box.xyxy)
23
 
24
- # Render and return the result
25
  render = render_result(model=model, image=image, result=result[0])
26
- return render
 
 
 
 
27
 
28
  # Define inputs for the Gradio app
29
  inputs = [
 
 
1
  import gradio as gr
2
  import torch
3
  from ultralyticsplus import YOLO, render_result
4
+ from PIL import Image
5
+ import os
6
 
7
  def yolov8_func(image,
8
  image_size,
 
22
  print("Confidence: ", box.conf)
23
  print("Coordinates: ", box.xyxy)
24
 
25
+ # Render the result
26
  render = render_result(model=model, image=image, result=result[0])
27
+
28
+ # Save the rendered image locally
29
+ save_path = "predicted_image.jpg" # Specify the output path
30
+ render.save(save_path) # Save using PIL's save method
31
+ return save_path
32
 
33
  # Define inputs for the Gradio app
34
  inputs = [