Spaces:
Running
on
Zero
Running
on
Zero
add docstrings explanation for MCP server mode
Browse files
app.py
CHANGED
|
@@ -80,6 +80,24 @@ def visualize_all(pil_image, heatmaps, bboxes, inout_scores, inout_thresh=0.5):
|
|
| 80 |
|
| 81 |
@spaces.GPU() # ZeroGPU ready
|
| 82 |
def main(image_input, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
# load image
|
| 84 |
image = Image.open(image_input)
|
| 85 |
width, height = image.size
|
|
@@ -163,4 +181,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 163 |
inputs = [input_image],
|
| 164 |
outputs = [result, heatmaps]
|
| 165 |
)
|
| 166 |
-
demo.queue().launch(
|
|
|
|
| 80 |
|
| 81 |
@spaces.GPU() # ZeroGPU ready
|
| 82 |
def main(image_input, progress=gr.Progress(track_tqdm=True)):
|
| 83 |
+
|
| 84 |
+
"""Estimate gaze direction for detected faces in an image using Gaze-LLE.
|
| 85 |
+
|
| 86 |
+
This function processes an input image to detect faces, estimates gaze heatmaps
|
| 87 |
+
for each face using a pre-trained Gaze-LLE model, and then visualizes the results
|
| 88 |
+
including gaze direction and whether each person's gaze is within the frame.
|
| 89 |
+
|
| 90 |
+
Args:
|
| 91 |
+
image_input: A filepath to the input image. Should be a photo containing one or more human faces.
|
| 92 |
+
progress: Optional Gradio progress tracker for UI feedback (used during inference).
|
| 93 |
+
|
| 94 |
+
Returns:
|
| 95 |
+
result_gazed (PIL.Image.Image): A single composite image with bounding boxes around faces,
|
| 96 |
+
lines indicating predicted gaze direction, and indicators of whether gaze is "in-frame".
|
| 97 |
+
heatmap_results (List[PIL.Image.Image]): A list of individual images, one per face, each showing
|
| 98 |
+
the original image overlaid with a heatmap of the predicted gaze target.
|
| 99 |
+
"""
|
| 100 |
+
|
| 101 |
# load image
|
| 102 |
image = Image.open(image_input)
|
| 103 |
width, height = image.size
|
|
|
|
| 181 |
inputs = [input_image],
|
| 182 |
outputs = [result, heatmaps]
|
| 183 |
)
|
| 184 |
+
demo.queue().launch(ssr_mode=False, show_error=True, mcp_server=True)
|