Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -232,13 +232,7 @@ def update_task(task, prompt):
|
|
| 232 |
else:
|
| 233 |
current_prompt = prompt
|
| 234 |
print(f"Updating task to: {task}, prompt to: {current_prompt}")
|
| 235 |
-
|
| 236 |
-
prediction = predict_image_json(image, current_task, current_prompt)
|
| 237 |
-
annotated_image_path = annotate_image(image, prediction, current_task)
|
| 238 |
-
predicted_objects = predicted_objects_num(prediction, current_task)
|
| 239 |
-
latest_image_info["path"] = annotated_image_path
|
| 240 |
-
latest_image_info["objnum"] = predicted_objects
|
| 241 |
-
return annotated_image_path, predicted_objects, gr.update(visible=task != "<OD>")
|
| 242 |
|
| 243 |
with gr.Blocks(css="footer {visibility: hidden}") as iface:
|
| 244 |
gr.Markdown("## MS Computer Vision Demo")
|
|
@@ -269,7 +263,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as iface:
|
|
| 269 |
value="detect all objects"
|
| 270 |
)
|
| 271 |
prompt_input = gr.Textbox(label="Prompt(Optional)", placeholder="what is object want to detect?", visible=False)
|
| 272 |
-
task_input.change(fn=update_task, inputs=[task_input, prompt_input], outputs=[
|
| 273 |
commit_button = gr.Button("Commit")
|
| 274 |
commit_button.click(fn=commit_prompt, inputs=[prompt_input], outputs=[image_output, detected_objects_output])
|
| 275 |
with gr.Column(scale=1):
|
|
|
|
| 232 |
else:
|
| 233 |
current_prompt = prompt
|
| 234 |
print(f"Updating task to: {task}, prompt to: {current_prompt}")
|
| 235 |
+
return gr.update(visible=task != "<OD>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
| 237 |
with gr.Blocks(css="footer {visibility: hidden}") as iface:
|
| 238 |
gr.Markdown("## MS Computer Vision Demo")
|
|
|
|
| 263 |
value="detect all objects"
|
| 264 |
)
|
| 265 |
prompt_input = gr.Textbox(label="Prompt(Optional)", placeholder="what is object want to detect?", visible=False)
|
| 266 |
+
task_input.change(fn=update_task, inputs=[task_input, prompt_input], outputs=[prompt_input])
|
| 267 |
commit_button = gr.Button("Commit")
|
| 268 |
commit_button.click(fn=commit_prompt, inputs=[prompt_input], outputs=[image_output, detected_objects_output])
|
| 269 |
with gr.Column(scale=1):
|