aifeifei798's picture
Upload 4 files
29c38ce verified
raw
history blame
1.26 kB
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()