image-points / app.py
injet-zhou
initial commit
4c07366
raw
history blame contribute delete
No virus
620 Bytes
import gradio as gr
from gradio_image_prompter import ImagePrompter
def format_points_output(points):
point_html = "<div style='font-size: 20px;'>[</div>"
for point in points:
point_html += f"<div style='font-size: 20px;'>&nbsp;&nbsp;&nbsp;&nbsp;{point},</div>"
point_html += "<div style='font-size: 20px;'>]</div>"
return point_html
def show(prompts):
points = [[int(point[0]), int(point[1])] for point in prompts["points"]]
return (format_points_output(points),)
demo = gr.Interface(
show,
ImagePrompter(show_label=False),
[gr.HTML(label="Points")],
)
demo.launch()