Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,17 +17,10 @@ import subprocess
|
|
| 17 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 18 |
|
| 19 |
models = {
|
| 20 |
-
'microsoft/Florence-2-large
|
| 21 |
-
'microsoft/Florence-2-large': AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True).to("cuda").eval(),
|
| 22 |
-
'microsoft/Florence-2-base-ft': AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base-ft', trust_remote_code=True).to("cuda").eval(),
|
| 23 |
-
'microsoft/Florence-2-base': AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True).to("cuda").eval(),
|
| 24 |
-
}
|
| 25 |
|
| 26 |
processors = {
|
| 27 |
-
'microsoft/Florence-2-large
|
| 28 |
-
'microsoft/Florence-2-large': AutoProcessor.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True),
|
| 29 |
-
'microsoft/Florence-2-base-ft': AutoProcessor.from_pretrained('microsoft/Florence-2-base-ft', trust_remote_code=True),
|
| 30 |
-
'microsoft/Florence-2-base': AutoProcessor.from_pretrained('microsoft/Florence-2-base', trust_remote_code=True),
|
| 31 |
}
|
| 32 |
|
| 33 |
|
|
@@ -210,12 +203,9 @@ with gr.Blocks(css=css) as demo:
|
|
| 210 |
input_img = gr.Image(label="Input Picture")
|
| 211 |
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='microsoft/Florence-2-large')
|
| 212 |
task_prompt = gr.Dropdown(choices=[
|
| 213 |
-
'Caption', 'Detailed Caption', 'More Detailed Caption',
|
| 214 |
-
'Dense Region Caption', 'Region Proposal', 'Caption to Phrase Grounding',
|
| 215 |
-
'Referring Expression Segmentation', 'Region to Segmentation',
|
| 216 |
-
'Open Vocabulary Detection', 'Region to Category', 'Region to Description',
|
| 217 |
'OCR', 'OCR with Region'
|
| 218 |
-
], label="Task Prompt", value= 'Caption')
|
| 219 |
text_input = gr.Textbox(label="Text Input (optional)")
|
| 220 |
submit_btn = gr.Button(value="Submit")
|
| 221 |
with gr.Column():
|
|
|
|
| 17 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
| 18 |
|
| 19 |
models = {
|
| 20 |
+
'microsoft/Florence-2-large': AutoModelForCausalLM.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True).to("cuda").eval()}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
processors = {
|
| 23 |
+
'microsoft/Florence-2-large': AutoProcessor.from_pretrained('microsoft/Florence-2-large', trust_remote_code=True)
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
|
|
|
|
| 203 |
input_img = gr.Image(label="Input Picture")
|
| 204 |
model_selector = gr.Dropdown(choices=list(models.keys()), label="Model", value='microsoft/Florence-2-large')
|
| 205 |
task_prompt = gr.Dropdown(choices=[
|
| 206 |
+
'Caption', 'Detailed Caption', 'More Detailed Caption',
|
|
|
|
|
|
|
|
|
|
| 207 |
'OCR', 'OCR with Region'
|
| 208 |
+
], label="Task Prompt", value= 'More Detailed Caption')
|
| 209 |
text_input = gr.Textbox(label="Text Input (optional)")
|
| 210 |
submit_btn = gr.Button(value="Submit")
|
| 211 |
with gr.Column():
|