nagasurendra commited on
Commit
0f4a528
·
verified ·
1 Parent(s): 105d958

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -4,10 +4,11 @@ import gradio as gr
4
  from ultralytics import YOLO
5
  from transformers import AutoImageProcessor, AutoModelForDepthEstimation
6
  from PIL import Image
 
7
 
8
  # Load YOLO model for tree detection
9
- # Replace "path_to_your_yolo_model.pt" with your model path (e.g., local or Hugging Face Hub)
10
- yolo_model = YOLO("./data/best.pt") # Update with your YOLO model path
11
 
12
  # Load depth estimation model and processor from Hugging Face
13
  processor = AutoImageProcessor.from_pretrained("Intel/dpt-large")
@@ -106,5 +107,5 @@ iface = gr.Interface(
106
  description="Upload an image to detect trees and estimate their heights in centimeters. Adjust camera parameters and depth scale as needed."
107
  )
108
 
109
- # Launch the interface
110
- iface.launch()
 
4
  from ultralytics import YOLO
5
  from transformers import AutoImageProcessor, AutoModelForDepthEstimation
6
  from PIL import Image
7
+ import torch # Added torch import for depth estimation
8
 
9
  # Load YOLO model for tree detection
10
+ # Replace with your model path (local or Hugging Face Hub)
11
+ yolo_model = YOLO("./data/best.pt") # Update with your YOLO model path
12
 
13
  # Load depth estimation model and processor from Hugging Face
14
  processor = AutoImageProcessor.from_pretrained("Intel/dpt-large")
 
107
  description="Upload an image to detect trees and estimate their heights in centimeters. Adjust camera parameters and depth scale as needed."
108
  )
109
 
110
+ # Launch the interface locally
111
+ iface.launch(server_name="0.0.0.0", server_port=7860)