Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files14 unmodified lines1516171819206 unmodified lines2728293031323334353648 unmodified lines8586878889909146 unmodified lines13813914014114214314499 unmodified lines24424524624724824925025125214 unmodified linesfrom transformers import (Qwen2_5_VLForConditionalGeneration,AutoProcessor,TextIteratorStreamer,)6 unmodified linesdevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")# Load Cosmos-Reason1-7BMODEL_ID_M = "nvidia/Cosmos-Reason1-7B"processor_m = AutoProcessor.from_pretrained(MODEL_ID_M, trust_remote_code=True)model_m = Qwen2_5_VLForConditionalGeneration.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":processor = processor_mmodel = model_melif model_name == "docscopeOCR-7B-050425-exp":46 unmodified lines"""Generates responses using the selected model for video input."""if model_name == "Cosmos-Reason1-7B":processor = processor_mmodel = model_melif model_name == "docscopeOCR-7B-050425-exp":99 unmodified lineswith 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"],label="Select Model",value="Cosmos-Reason1-7B")gr.Markdown("**Model Info**")14 unmodified lines151617181920216 unmodified lines2829303132333435363748 unmodified lines8687888990919246 unmodified lines13914014114214314414599 unmodified lines24524624724824925025125225314 unmodified linesfrom transformers import (Qwen2_5_VLForConditionalGeneration,Gemma3ForConditionalGeneration,AutoProcessor,TextIteratorStreamer,)6 unmodified linesdevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")# 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 = 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 == "gemma-3-4b-it":processor = processor_mmodel = model_melif model_name == "docscopeOCR-7B-050425-exp":46 unmodified lines"""Generates responses using the selected model for video input."""if model_name == "gemma-3-4b-it":processor = processor_mmodel = model_melif model_name == "docscopeOCR-7B-050425-exp":99 unmodified lineswith gr.Column():output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)model_choice = gr.Radio(choices=["gemma-3-4b-it", "docscopeOCR-7B-050425-exp", "Captioner-7B"],label="Select Model",value="gemma-3-4b-it")gr.Markdown("**Model Info**")
app.py+8-7