prithivMLmods commited on
Commit
cf8e85e
·
verified ·
1 Parent(s): 0824a2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -45,6 +45,16 @@ model_x = Qwen2_5_VLForConditionalGeneration.from_pretrained(
45
  trust_remote_code=True,
46
  torch_dtype=torch.float16
47
  ).to(device).eval()
 
 
 
 
 
 
 
 
 
 
48
  def downsample_video(video_path):
49
  """
50
  Downsamples the video to evenly spaced frames.
@@ -82,6 +92,9 @@ def generate_image(model_name: str, text: str, image: Image.Image,
82
  elif model_name == "DREX-062225-exp":
83
  processor = processor_x
84
  model = model_x
 
 
 
85
  else:
86
  yield "Invalid model selected."
87
  return
@@ -133,6 +146,9 @@ def generate_video(model_name: str, text: str, video_path: str,
133
  elif model_name == "DREX-062225-exp":
134
  processor = processor_x
135
  model = model_x
 
 
 
136
  else:
137
  yield "Invalid model selected."
138
  return
@@ -231,7 +247,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
231
  with gr.Column():
232
  output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
233
  model_choice = gr.Radio(
234
- choices=["DREX-062225-exp", "VIREX-062225-exp"],
235
  label="Select Model",
236
  value="DREX-062225-exp"
237
  )
 
45
  trust_remote_code=True,
46
  torch_dtype=torch.float16
47
  ).to(device).eval()
48
+
49
+ # Load olmOCR-7B-0225-preview
50
+ MODEL_ID_O = "allenai/olmOCR-7B-0225-preview"
51
+ processor_o = AutoProcessor.from_pretrained(MODEL_ID_O, trust_remote_code=True)
52
+ model_o = Qwen2VLForConditionalGeneration.from_pretrained(
53
+ MODEL_ID_O,
54
+ trust_remote_code=True,
55
+ torch_dtype=torch.float16
56
+ ).to(device).eval()
57
+
58
  def downsample_video(video_path):
59
  """
60
  Downsamples the video to evenly spaced frames.
 
92
  elif model_name == "DREX-062225-exp":
93
  processor = processor_x
94
  model = model_x
95
+ elif model_name == "olmOCR-7B-0225":
96
+ processor = processor_o
97
+ model = model_o
98
  else:
99
  yield "Invalid model selected."
100
  return
 
146
  elif model_name == "DREX-062225-exp":
147
  processor = processor_x
148
  model = model_x
149
+ elif model_name == "olmOCR-7B-0225":
150
+ processor = processor_o
151
+ model = model_o
152
  else:
153
  yield "Invalid model selected."
154
  return
 
247
  with gr.Column():
248
  output = gr.Textbox(label="Output", interactive=False, lines=2, scale=2)
249
  model_choice = gr.Radio(
250
+ choices=["DREX-062225-exp", "VIREX-062225-exp", "olmOCR-7B-0225"],
251
  label="Select Model",
252
  value="DREX-062225-exp"
253
  )