Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,17 @@ text format. It uses a DaViT vision encoder to convert images into visual token
|
|
| 29 |
embeddings. These are then concatenated with BERT-generated text embeddings and
|
| 30 |
processed by a transformer-based multi-modal encoder-decoder to generate the response.
|
| 31 |
"""
|
|
|
|
| 32 |
EXAMPLES = [
|
| 33 |
-
["microsoft/Florence-2-large-ft", OBJECT_DETECTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-2.jpeg", None]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
]
|
| 35 |
|
| 36 |
# DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
@@ -89,7 +98,7 @@ with gr.Blocks() as demo:
|
|
| 89 |
with gr.Row():
|
| 90 |
checkpoint_dropdown_component = gr.Dropdown(
|
| 91 |
choices=CHECKPOINTS,
|
| 92 |
-
value=
|
| 93 |
label="Model", info="Select a Florence 2 model to use.",
|
| 94 |
interactive=True
|
| 95 |
)
|
|
@@ -160,4 +169,4 @@ with gr.Blocks() as demo:
|
|
| 160 |
]
|
| 161 |
)
|
| 162 |
|
| 163 |
-
demo.launch(debug=
|
|
|
|
| 29 |
embeddings. These are then concatenated with BERT-generated text embeddings and
|
| 30 |
processed by a transformer-based multi-modal encoder-decoder to generate the response.
|
| 31 |
"""
|
| 32 |
+
|
| 33 |
EXAMPLES = [
|
| 34 |
+
["microsoft/Florence-2-large-ft", OBJECT_DETECTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-2.jpeg", None],
|
| 35 |
+
["microsoft/Florence-2-large-ft", REGION_PROPOSAL_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-3.jpeg", None],
|
| 36 |
+
["microsoft/Florence-2-large-ft", DENSE_REGION_CAPTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-3.jpeg", None],
|
| 37 |
+
["microsoft/Florence-2-large-ft", CAPTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-2.jpeg", None],
|
| 38 |
+
["microsoft/Florence-2-large-ft", DETAILED_CAPTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-2.jpeg", None],
|
| 39 |
+
["microsoft/Florence-2-large-ft", MORE_DETAILED_CAPTION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/dog-2.jpeg", None],
|
| 40 |
+
["microsoft/Florence-2-large-ft", OCR_TASK_NAME, "https://media.roboflow.com/notebooks/examples/handwritten-text.jpg", None],
|
| 41 |
+
["microsoft/Florence-2-large-ft", OCR_WITH_REGION_TASK_NAME, "https://media.roboflow.com/notebooks/examples/handwritten-text.jpg", None],
|
| 42 |
+
["microsoft/Florence-2-large-ft", OCR_WITH_REGION_TASK_NAME, "https://media.roboflow.com/inference/license_plate_1.jpg", None],
|
| 43 |
]
|
| 44 |
|
| 45 |
# DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
| 98 |
with gr.Row():
|
| 99 |
checkpoint_dropdown_component = gr.Dropdown(
|
| 100 |
choices=CHECKPOINTS,
|
| 101 |
+
value=CHECKPOINTS[0],
|
| 102 |
label="Model", info="Select a Florence 2 model to use.",
|
| 103 |
interactive=True
|
| 104 |
)
|
|
|
|
| 169 |
]
|
| 170 |
)
|
| 171 |
|
| 172 |
+
demo.launch(debug=False, show_error=True, max_threads=1)
|