File size: 1,473 Bytes
0a20aa8
 
 
 
 
 
 
 
 
0a9682f
ab714f3
0a20aa8
 
0a9682f
1625b07
7405ff8
0a20aa8
2698e40
0a20aa8
 
 
 
 
 
 
 
2b78f5b
0a20aa8
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import gradio as gr
from PIL import Image
import torch

os.system('mkdir weights')
os.system('curl -L -o weights/hybridnets.pth https://github.com/datvuthanh/HybridNets/releases/download/v1.0/hybridnets.pth')

def inference(img):

    img = img.resize((1280,720))
    
    img.save("demo/image/1.jpg", "JPEG")
    
    #os.system('python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True --cuda False')
    os.system('python hybridnets_test.py -w weights/hybridnets.pth --source demo/image --output demo_result --imshow False --imwrite True --cuda False --float16 False')
    
    return 'demo_result/0.jpg'
        
title="HybridNets Demo"

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"

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>"


examples=[['1.jpg'],['2.jpg'],['3.jpg']]
gr.Interface(
    inference, 
    [gr.inputs.Image(type="pil", label="Input")], 
    gr.outputs.Image(type="file", label="Output"),
    title=title,
    description=description,
    article=article,
    enable_queue=True,
    examples=examples
    ).launch(debug=True)