File size: 1,256 Bytes
b3837a7
 
 
6f0c5ee
 
 
 
 
 
 
 
 
 
 
 
 
 
81bf781
b3837a7
 
 
29c38ce
9b0c61b
6734e81
a04fae7
b88ce12
 
 
b3837a7
 
 
b88ce12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from feifeilib.feifeiflorencebase import process_image

DESCRIPTION = "# [Florence-2 Image to Flux Prompt](https://huggingface.co/microsoft/Florence-2-base)"

single_task_list =[
    'Caption', 'Detailed Caption', 'More Detailed Caption', 'Object Detection',
    'Dense Region Caption', 'Region Proposal', 'Caption to Phrase Grounding',
    'Referring Expression Segmentation', 'Region to Segmentation',
    'Open Vocabulary Detection', 'Region to Category', 'Region to Description',
    'OCR', 'OCR with Region'
]

cascased_task_list =[
    'Caption + Grounding', 'Detailed Caption + Grounding', 'More Detailed Caption + Grounding'
]

with gr.Blocks() as demo:
    gr.Markdown(DESCRIPTION)
    with gr.Tab(label="Florence-2 Image to Flux Prompt"):
        with gr.Row():
            input_img = gr.Image(label="Input Picture",height=320,type="filepath")
        with gr.Row():
            submit_btn = gr.Button(value="GenPrompt")
        with gr.Row():
            output_text = gr.Textbox(label="Flux Prompt",
                                     show_label=False,
                                     container=False)

        submit_btn.click(process_image, [input_img], [output_text])

demo.launch()