Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files14 unmodified lines151617181920216 unmodified lines2829303031313233333435363748 unmodified lines868788888990919246 unmodified lines13914014114114214314414599 unmodified lines24524624724724824924925025125225314 unmodified lines
from transformers import ( Qwen2_5_VLForConditionalGeneration, Gemma3ForConditionalGeneration, AutoProcessor, TextIteratorStreamer,)6 unmodified lines
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# Load Cosmos-Reason1-7BMODEL_ID_M = "nvidia/Cosmos-Reason1-7B"# Load gemma-3-4b-itMODEL_ID_M = "google/gemma-3-4b-it"processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)model_m = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_m = Gemma3ForConditionalGeneration.from_pretrained( MODEL_ID_M, trust_remote_code=True, torch_dtype=torch.float1648 unmodified lines """ Generates responses using the selected model for image input. """ if model_name == "Cosmos-Reason1-7B": if model_name == "gemma-3-4b-it": processor = processor_m model = model_m elif model_name == "docscopeOCR-7B-050425-exp":46 unmodified lines """ Generates responses using the selected model for video input. """ if model_name == "Cosmos-Reason1-7B": if model_name == "gemma-3-4b-it": processor = processor_m model = model_m elif model_name == "docscopeOCR-7B-050425-exp":99 unmodified lines with gr.Column(): output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2) model_choice = gr.Radio( choices=["Cosmos-Reason1-7B", "docscopeOCR-7B-050425-exp", "Captioner-7B"], choices=["gemma-3-4b-it", "docscopeOCR-7B-050425-exp", "Captioner-7B"], label="Select Model", value="Cosmos-Reason1-7B" value="gemma-3-4b-it" ) gr.Markdown("**Model Info**")app.py+8-7