File size: 632 Bytes
1ad0483
 
1c46df5
1ad0483
1c46df5
 
 
 
6a18cf5
1c46df5
 
 
 
6a18cf5
 
1c46df5
 
 
 
 
 
8c055ae
1c46df5
 
 
 
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
import gradio as gr

from chrislib.general import uninvert, view

from intrinsic.pipeline import run_pipeline
from intrinsic.model_util import load_models

global intrinsic_model
intrinsic_model = load_models('paper_weights', device='cpu')

def decompose(img):
    result = run_pipeline(
        img,
        intrinsic_model,
        device='cpu'
    )

    return view(uninvert(result['inv_shd'])), "Completed"


gr.Interface(
    decompose,
    [gr.inputs.Image(type="numpy", label="Input")],
    [gr.outputs.Image(type="numpy", label="Output"), gr.outputs.Textbox(label=":")],
    examples=[["avocado.jpg"]]
).launch(debug=True)