Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
from PIL import Image
|
4 |
+
import torch
|
5 |
+
|
6 |
+
os.system('mkdir weights')
|
7 |
+
os.system('curl -L -o weights/hybridnets.pth https://github.com/datvuthanh/HybridNets/releases/download/v1.0/hybridnets.pth')
|
8 |
+
|
9 |
+
def inference(img):
|
10 |
+
|
11 |
+
img.save("demo/image/1.jpg", "JPEG")
|
12 |
+
os.system('python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True')
|
13 |
+
|
14 |
+
return 'demo_result/1.jpg'
|
15 |
+
|
16 |
+
title="HybridNets Demo"
|
17 |
+
|
18 |
+
description="Gradio demo for HybridNets: End2End Perception Network pretrained on BDD100k Dataset. To use it, simply upload your image or click on one of the examples to load them. Read more at the links below"
|
19 |
+
|
20 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2203.09035' target='_blank'>ybridNets: End2End Perception Network</a> | <a href='https://github.com/datvuthanh/HybridNets' target='_blank'>Github Repo</a></p>"
|
21 |
+
|
22 |
+
|
23 |
+
examples=[['1.jpg']]
|
24 |
+
gr.Interface(
|
25 |
+
inference,
|
26 |
+
[gr.inputs.Image(type="pil", label="Input")],
|
27 |
+
gr.outputs.Image(type="file", label="Output"),
|
28 |
+
title=title,
|
29 |
+
description=description,
|
30 |
+
article=article,
|
31 |
+
enable_queue=True,
|
32 |
+
examples=examples
|
33 |
+
).launch(debug=True)
|