jens
fix
b71fb05
raw
history blame
751 Bytes
import gradio as gr
from segment_anything import SamAutomaticMaskGenerator, sam_model_registry
import supervision as sv
from inference import DepthPredictor, SegmentPredictor
from utils import create_3d_obj
import numpy as np
def snap(image, video):
depth_predictor = DepthPredictor()
depth_result = depth_predictor.predict(image)
gltf_path = create_3d_obj(np.array(image), depth_result)
#segment_predictor = SegmentPredictor()
#sam_result = segment_predictor.predict(image)
return [gltf_path, video]#[depth_result, gltf_path, gltf_path]
demo = gr.Interface(
snap,
[gr.Image(source="webcam", tool=None, type="pil"), gr.Video(source="webcam")],
["image", "video"],
)
if __name__ == "__main__":
demo.launch()