Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
# MegaDetector v5 Demo
|
| 2 |
import gradio as gr
|
| 3 |
-
import torch
|
| 4 |
-
import torchvision
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
|
| 8 |
# Load MegaDetector v5a model
|
| 9 |
# TODO: Allow user selectable model?
|
| 10 |
# models = ["model_weights/md_v5a.0.0.pt","model_weights/md_v5b.0.0.pt"]
|
| 11 |
-
model = torch.hub.load('ultralytics/yolov5', 'custom', "model_weights/md_v5a.0.0.pt")
|
| 12 |
|
| 13 |
def yolo(im, size=640):
|
| 14 |
g = (size / max(im.size)) # gain
|
|
@@ -28,9 +28,9 @@ def yolo(im, size=640):
|
|
| 28 |
inputs = gr.inputs.Image(type="pil", label="Input Image")
|
| 29 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
| 30 |
|
| 31 |
-
title = "MegaDetector
|
| 32 |
-
description = "
|
| 33 |
-
|
| 34 |
|
| 35 |
examples = [['data/Macropod.jpg'], ['data/koala2.jpg'],['data/cat.jpg'],['data/BrushtailPossum.jpg']]
|
| 36 |
gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, theme="huggingface").launch(enable_queue=True)
|
|
|
|
| 1 |
# MegaDetector v5 Demo
|
| 2 |
import gradio as gr
|
| 3 |
+
#import torch
|
| 4 |
+
#import torchvision
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
|
| 8 |
# Load MegaDetector v5a model
|
| 9 |
# TODO: Allow user selectable model?
|
| 10 |
# models = ["model_weights/md_v5a.0.0.pt","model_weights/md_v5b.0.0.pt"]
|
| 11 |
+
#model = torch.hub.load('ultralytics/yolov5', 'custom', "model_weights/md_v5a.0.0.pt")
|
| 12 |
|
| 13 |
def yolo(im, size=640):
|
| 14 |
g = (size / max(im.size)) # gain
|
|
|
|
| 28 |
inputs = gr.inputs.Image(type="pil", label="Input Image")
|
| 29 |
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
| 30 |
|
| 31 |
+
title = "MegaDetector and DeepLabcutLive"
|
| 32 |
+
description = "Interact with MegaDetector and DeeplabCutLive for pose estimation"
|
| 33 |
+
|
| 34 |
|
| 35 |
examples = [['data/Macropod.jpg'], ['data/koala2.jpg'],['data/cat.jpg'],['data/BrushtailPossum.jpg']]
|
| 36 |
gr.Interface(yolo, inputs, outputs, title=title, description=description, article=article, examples=examples, theme="huggingface").launch(enable_queue=True)
|