dwb2023 commited on
Commit
fe7d0b5
·
verified ·
1 Parent(s): c2a3a62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -40,7 +40,7 @@ def fig_to_pil(fig):
40
  return Image.open(buf)
41
 
42
  @spaces.GPU
43
- def run_example(task_prompt, image, text_input=None, model_id='dwb2023/florence2-large-bccd-base-ft'):
44
  model = models[model_id]
45
  processor = processors[model_id]
46
  if text_input is None:
@@ -118,7 +118,7 @@ def draw_ocr_bboxes(image, prediction):
118
  fill=color)
119
  return image
120
 
121
- def process_image(image, task_prompt, text_input=None, model_id='dwb2023/florence2-large-bccd-base-ft'):
122
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
123
  if task_prompt == 'Object Detection':
124
  task_prompt = '<OD>'
@@ -145,7 +145,7 @@ with gr.Blocks(theme="sudeepshouche/minimalist") as demo:
145
  with gr.Row():
146
  with gr.Column():
147
  input_img = gr.Image(label="Input Picture")
148
- model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='dwb2023/florence2-large-bccd-base-ft')
149
  task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Object Detection")
150
  text_input = gr.Textbox(label="Text Input", placeholder="Not used for Florence-2 Object Detection")
151
  submit_btn = gr.Button(value="Submit")
 
40
  return Image.open(buf)
41
 
42
  @spaces.GPU
43
+ def run_example(task_prompt, image, text_input=None, model_id='dwb2023/florence2-large-liver-disease-ft'):
44
  model = models[model_id]
45
  processor = processors[model_id]
46
  if text_input is None:
 
118
  fill=color)
119
  return image
120
 
121
+ def process_image(image, task_prompt, text_input=None, model_id='dwb2023/florence2-large-liver-disease-ft'):
122
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
123
  if task_prompt == 'Object Detection':
124
  task_prompt = '<OD>'
 
145
  with gr.Row():
146
  with gr.Column():
147
  input_img = gr.Image(label="Input Picture")
148
+ model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='dwb2023/florence2-large-liver-disease-ft')
149
  task_prompt = gr.Dropdown(choices=single_task_list, label="Task Prompt", value="Object Detection")
150
  text_input = gr.Textbox(label="Text Input", placeholder="Not used for Florence-2 Object Detection")
151
  submit_btn = gr.Button(value="Submit")