joaomorossini commited on
Commit
43bc0c8
·
1 Parent(s): b24d3c5

Update app.py

Browse files

Removed endpoints which caused errors

Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -22,12 +22,8 @@ endpoints = [
22
  "Salesforce/blip-image-captioning-base",
23
  "nlpconnect/vit-gpt2-image-captioning",
24
  "microsoft/git-base",
25
- "microsoft/kosmos-2-patch14-224",
26
  "microsoft/git-large-textcaps",
27
  "microsoft/git-large-r-coco",
28
- "facebook/nougat-base",
29
- "Norm/nougat-latex-base",
30
- "bipin/image-caption-generator",
31
  ]
32
 
33
 
@@ -77,10 +73,10 @@ def captioner(image):
77
  for endpoint, result in results.items():
78
  if "error" not in result:
79
  caption = (
80
- f"**{endpoint}**: \n\n {result[0]['generated_text']} \n\n\n "
81
  )
82
  else:
83
- caption = f"**{endpoint}**: \n\n Error - {result['error']} \n\n\n "
84
  captions.append(caption)
85
  return "".join(captions) # Join all captions into a single string
86
 
@@ -90,8 +86,8 @@ demo = gr.Interface(
90
  fn=captioner,
91
  inputs=[gr.Image(label="Upload image", type="pil")],
92
  outputs=gr.Markdown(label="Captions"),
93
- title="COMPARE DIFFERENT IMAGE CAPTIONING MODELS",
94
- description="Upload an image and see how different models caption it",
95
  allow_flagging="never",
96
  examples=[
97
  "example_1.jpg",
 
22
  "Salesforce/blip-image-captioning-base",
23
  "nlpconnect/vit-gpt2-image-captioning",
24
  "microsoft/git-base",
 
25
  "microsoft/git-large-textcaps",
26
  "microsoft/git-large-r-coco",
 
 
 
27
  ]
28
 
29
 
 
73
  for endpoint, result in results.items():
74
  if "error" not in result:
75
  caption = (
76
+ f"## {endpoint}: \n {result[0]['generated_text']} \n\n\n"
77
  )
78
  else:
79
+ caption = f"## {endpoint}: \n Error - {result['error']} \n\n\n"
80
  captions.append(caption)
81
  return "".join(captions) # Join all captions into a single string
82
 
 
86
  fn=captioner,
87
  inputs=[gr.Image(label="Upload image", type="pil")],
88
  outputs=gr.Markdown(label="Captions"),
89
+ title="Captioning Comparison",
90
+ description="Upload an image and see how different models describe it!",
91
  allow_flagging="never",
92
  examples=[
93
  "example_1.jpg",