Spaces:
Runtime error
Runtime error
File size: 1,030 Bytes
ba4b32e ad671e3 ba4b32e ad671e3 ba4b32e ad671e3 ba4b32e |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# import gradio as gr
# def greet(name):
# return "Hello " + name + "!!"
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch()
import gradio as gr
from ultralytics import YOLO
from PIL import Image
#Load model
model = YOLO('yolov8n.pt')
def image_display(input_image):
# Return the input image as the output
model = YOLO('yolov8n.pt')
results = model(input_image)
for r in results:
im_array = r.plot() # plot a BGR numpy array of predictions
im = Image.fromarray(im_array[..., ::-1]) # RGB PIL image
return im_array
input_component = gr.inputs.Image()
output_component = gr.outputs.Image()
# Create the Gradio interface
gr.Interface(
fn=image_display,
inputs=input_component,
outputs=output_component,
title="Image Display App",
description="Upload an image and see it displayed.",
theme="compact"
).launch(share=True)
# demo = gr.Interface(
# fn=greet,
# inputs='textbox',
# outputs='textbox',
# )
# demo.launch()
|