import gradio as gr from transformers import VideoLlavaForConditionalGeneration, VideoLlavaProcessor, TextIteratorStreamer from threading import Thread import re import time from PIL import Image import torch import cv2 import spaces model = VideoLlavaForConditionalGeneration.from_pretrained("LanguageBind/Video-LLaVA-7B-hf", torch_dtype=torch.float16, device_map="cuda") processor = VideoLlavaProcessor.from_pretrained("LanguageBind/Video-LLaVA-7B-hf") #model.to("cuda") def replace_video_with_images(text, frames): return text.replace("