Spaces:
Sleeping
Sleeping
File size: 859 Bytes
803b87c 2932b3e 803b87c 2932b3e 803b87c 2932b3e 803b87c 2932b3e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import gradio as gr
from diffusers import DiffusionPipeline
import torch
# Initialize the pipeline
pipe = DiffusionPipeline.from_pretrained("Lookingsoft-team/object_detection")
if torch.cuda.is_available():
pipe = pipe.to("cuda")
def detect_objects(image):
if image is None:
return None
# Process the image through the pipeline
# Note: This is a placeholder - actual processing will depend on the model's specific requirements
results = pipe(image=image)
# Return the processed image with detections
return results.images[0]
# Create Gradio interface
demo = gr.Interface(
fn=detect_objects,
inputs=gr.Image(type="pil"),
outputs=gr.Image(type="pil"),
title="Object Detection",
description="Upload an image and the model will detect objects in it!",
)
if __name__ == "__main__":
demo.launch()
|