samewind / app.py
scfive's picture
Update app.py
2a43d99 verified
raw
history blame contribute delete
775 Bytes
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()