File size: 775 Bytes
2a43d99 0af0696 2a43d99 0af0696 2a43d99 0af0696 2a43d99 0af0696 2a43d99 |
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 |
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
import gradio as gr
import os
from inference_custom import main as samwise_infer
def inference(video, prompt):
output_path = "output_segmented.mp4"
# 'video' is a file path string provided by Gradio
samwise_infer(video, prompt, output_path, "models/samwise.pth")
return output_path
demo = gr.Interface(
fn=inference,
inputs=[
gr.Video(label="Upload Video"),
gr.Textbox(label="Text Prompt", placeholder="Describe what to segment")
],
outputs=gr.Video(label="Segmented Output"),
title="SAMWISE Video Segmentation",
description="Upload a video and enter a prompt to segment objects with SAMWISE."
)
if __name__ == "__main__":
demo.launch()
|