aifeifei798 commited on
Commit
6f0c5ee
·
verified ·
1 Parent(s): 81bf781

Upload 4 files

Browse files
Files changed (2) hide show
  1. app.py +14 -0
  2. feifeilib/feifeiflorencebase.py +0 -16
app.py CHANGED
@@ -1,6 +1,20 @@
1
  import gradio as gr
2
  from feifeilib.feifeiflorencebase import process_image
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  with gr.Blocks() as demo:
5
  gr.Markdown(DESCRIPTION)
6
  with gr.Tab(label="Florence-2 Image to Flux Prompt"):
 
1
  import gradio as gr
2
  from feifeilib.feifeiflorencebase import process_image
3
 
4
+ DESCRIPTION = "# [Florence-2 Image to Flux Prompt](https://huggingface.co/microsoft/Florence-2-base)"
5
+
6
+ single_task_list =[
7
+ 'Caption', 'Detailed Caption', 'More Detailed Caption', 'Object Detection',
8
+ 'Dense Region Caption', 'Region Proposal', 'Caption to Phrase Grounding',
9
+ 'Referring Expression Segmentation', 'Region to Segmentation',
10
+ 'Open Vocabulary Detection', 'Region to Category', 'Region to Description',
11
+ 'OCR', 'OCR with Region'
12
+ ]
13
+
14
+ cascased_task_list =[
15
+ 'Caption + Grounding', 'Detailed Caption + Grounding', 'More Detailed Caption + Grounding'
16
+ ]
17
+
18
  with gr.Blocks() as demo:
19
  gr.Markdown(DESCRIPTION)
20
  with gr.Tab(label="Florence-2 Image to Flux Prompt"):
feifeilib/feifeiflorencebase.py CHANGED
@@ -25,8 +25,6 @@ processors = {
25
  }
26
 
27
 
28
- DESCRIPTION = "# [Florence-2 Image to Flux Prompt](https://huggingface.co/microsoft/Florence-2-base)"
29
-
30
  colormap = ['blue','orange','green','purple','brown','pink','gray','olive','cyan','red',
31
  'lime','indigo','violet','aqua','magenta','coral','gold','tan','skyblue']
32
 
@@ -215,20 +213,6 @@ def process_image(image, task_prompt = "More Detailed Caption", text_input=None,
215
  else:
216
  return "", None # Return empty string and None for unknown task prompts
217
 
218
-
219
- single_task_list =[
220
- 'Caption', 'Detailed Caption', 'More Detailed Caption', 'Object Detection',
221
- 'Dense Region Caption', 'Region Proposal', 'Caption to Phrase Grounding',
222
- 'Referring Expression Segmentation', 'Region to Segmentation',
223
- 'Open Vocabulary Detection', 'Region to Category', 'Region to Description',
224
- 'OCR', 'OCR with Region'
225
- ]
226
-
227
- cascased_task_list =[
228
- 'Caption + Grounding', 'Detailed Caption + Grounding', 'More Detailed Caption + Grounding'
229
- ]
230
-
231
-
232
  def update_task_dropdown(choice):
233
  if choice == 'Cascased task':
234
  return gr.Dropdown(choices=cascased_task_list, value='Caption + Grounding')
 
25
  }
26
 
27
 
 
 
28
  colormap = ['blue','orange','green','purple','brown','pink','gray','olive','cyan','red',
29
  'lime','indigo','violet','aqua','magenta','coral','gold','tan','skyblue']
30
 
 
213
  else:
214
  return "", None # Return empty string and None for unknown task prompts
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  def update_task_dropdown(choice):
217
  if choice == 'Cascased task':
218
  return gr.Dropdown(choices=cascased_task_list, value='Caption + Grounding')