Spaces:
Runtime error
Runtime error
File size: 751 Bytes
5c0b534 9b4ee8f 6b8e3c4 7598e8a 5c0b534 6b8e3c4 9780d7b 7598e8a 6b8e3c4 b71fb05 5c0b534 9780d7b 5c0b534 |
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 |
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() |