Gabolozano commited on
Commit
6564a3a
1 Parent(s): 9d66e56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -1,8 +1,16 @@
1
  import os
2
  import gradio as gr
3
  from transformers import pipeline
 
4
 
5
- od_pipe = pipeline("object-detection", "facebook/detr-resnet-50")
 
 
 
 
 
 
 
6
 
7
  def get_pipeline_prediction(pil_image):
8
  # first get the pipeline output given the pil image
@@ -10,6 +18,7 @@ def get_pipeline_prediction(pil_image):
10
  # Then Process the image using the pipeline output
11
  processed_image = render_results_in_image(pil_image,
12
  pipeline_output)
 
13
  return processed_image
14
 
15
 
 
1
  import os
2
  import gradio as gr
3
  from transformers import pipeline
4
+ from transformers import DetrForSegmentation, DetrConfig
5
 
6
+ # Initialize the configuration for DetrForObjectDetection
7
+ config = DetrConfig.from_pretrained("facebook/detr-resnet-50")
8
+
9
+ # Create the model for object detection using the specified configuration
10
+ model = DetrForSegmentation.from_pretrained("facebook/detr-resnet-50", config=config)
11
+
12
+ # Updated function call
13
+ results = processed_image(model, image, size={'longest_edge': 800})
14
 
15
  def get_pipeline_prediction(pil_image):
16
  # first get the pipeline output given the pil image
 
18
  # Then Process the image using the pipeline output
19
  processed_image = render_results_in_image(pil_image,
20
  pipeline_output)
21
+
22
  return processed_image
23
 
24