Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -94,7 +94,7 @@ def run_dfine_classify(image, encoder_choice, refs_path):
|
|
| 94 |
refs = Path(refs_path.strip()) if refs_path and refs_path.strip() else Path(REFS_DIR)
|
| 95 |
if not refs.is_dir():
|
| 96 |
return None, f"Refs folder not found: {refs}"
|
| 97 |
-
|
| 98 |
out_img, text = run_single_image(
|
| 99 |
image,
|
| 100 |
refs_dir=refs,
|
|
@@ -168,9 +168,9 @@ with gr.Blocks(title="Small Object Detection") as app:
|
|
| 168 |
|
| 169 |
with gr.TabItem("D-FINE + Classify"):
|
| 170 |
gr.Markdown(
|
| 171 |
-
"**D-FINE** runs first (person/car grouping), then small-object
|
| 172 |
"Choose **Jina** or **Nomic** for the embedding/classification model. "
|
| 173 |
-
"
|
| 174 |
)
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column(scale=1):
|
|
@@ -187,8 +187,8 @@ with gr.Blocks(title="Small Object Detection") as app:
|
|
| 187 |
)
|
| 188 |
btn_dfine = gr.Button("Run D-FINE + Classify", variant="primary")
|
| 189 |
with gr.Column(scale=1):
|
| 190 |
-
out_img_dfine = gr.Image(label="Output
|
| 191 |
-
out_text_dfine = gr.Textbox(label="
|
| 192 |
btn_dfine.click(
|
| 193 |
fn=run_dfine_classify,
|
| 194 |
inputs=[inp_dfine, encoder_choice, refs_path],
|
|
@@ -199,4 +199,4 @@ with gr.Blocks(title="Small Object Detection") as app:
|
|
| 199 |
app.launch(
|
| 200 |
server_name=os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0"),
|
| 201 |
server_port=int(os.environ.get("PORT", os.environ.get("GRADIO_SERVER_PORT", 7860))),
|
| 202 |
-
)
|
|
|
|
| 94 |
refs = Path(refs_path.strip()) if refs_path and refs_path.strip() else Path(REFS_DIR)
|
| 95 |
if not refs.is_dir():
|
| 96 |
return None, f"Refs folder not found: {refs}"
|
| 97 |
+
|
| 98 |
out_img, text = run_single_image(
|
| 99 |
image,
|
| 100 |
refs_dir=refs,
|
|
|
|
| 168 |
|
| 169 |
with gr.TabItem("D-FINE + Classify"):
|
| 170 |
gr.Markdown(
|
| 171 |
+
"**D-FINE** runs first (person/car grouping), then small-object detections inside each group crop are classified. "
|
| 172 |
"Choose **Jina** or **Nomic** for the embedding/classification model. "
|
| 173 |
+
"Only **known classes** are drawn. **Unknown** detections are skipped."
|
| 174 |
)
|
| 175 |
with gr.Row():
|
| 176 |
with gr.Column(scale=1):
|
|
|
|
| 187 |
)
|
| 188 |
btn_dfine = gr.Button("Run D-FINE + Classify", variant="primary")
|
| 189 |
with gr.Column(scale=1):
|
| 190 |
+
out_img_dfine = gr.Image(label="Output group crops", height=IMG_HEIGHT)
|
| 191 |
+
out_text_dfine = gr.Textbox(label="Known-class predictions", lines=10, interactive=False)
|
| 192 |
btn_dfine.click(
|
| 193 |
fn=run_dfine_classify,
|
| 194 |
inputs=[inp_dfine, encoder_choice, refs_path],
|
|
|
|
| 199 |
app.launch(
|
| 200 |
server_name=os.environ.get("GRADIO_SERVER_NAME", "0.0.0.0"),
|
| 201 |
server_port=int(os.environ.get("PORT", os.environ.get("GRADIO_SERVER_PORT", 7860))),
|
| 202 |
+
)
|