huy-ha commited on
Commit
83700f0
1 Parent(s): 79807b5

remove try catch

Browse files
Files changed (1) hide show
  1. app.py +29 -32
app.py CHANGED
@@ -24,17 +24,14 @@ def add_text_to_image(
24
  ):
25
  image = Image.fromarray(image)
26
  draw = ImageDraw.Draw(image)
27
- try:
28
- image = draw.text(
29
- position,
30
- text,
31
- fill=color,
32
- font=ImageFont.truetype(
33
- "/usr/share/fonts/truetype/lato/Lato-Medium.ttf", fontsize
34
- ),
35
- )
36
- except:
37
- image = draw.text(position, text, fill=color, font=ImageFont.load_default())
38
  return np.array(image)
39
 
40
 
@@ -106,27 +103,27 @@ This relevancy extractor builds heavily on [Chefer et al.'s codebase](https://gi
106
  "ours_fast",
107
  True,
108
  ],
109
- # [
110
- # "https://semantic-abstraction.cs.columbia.edu/downloads/livingroom.png",
111
- # "monopoly boardgame set,door knob,sofa,coffee table,plant,carpet,wall",
112
- # "a photograph of a {} in a home.",
113
- # "ours_fast",
114
- # True,
115
- # ],
116
- # [
117
- # "https://semantic-abstraction.cs.columbia.edu/downloads/fireplace.png",
118
- # "fireplace,beige armchair,candle,large indoor plant in a pot,forest painting,cheetah-patterned pillow,floor,carpet,wall",
119
- # "a photograph of a {} in a home.",
120
- # "ours_fast",
121
- # True,
122
- # ],
123
- # [
124
- # "https://semantic-abstraction.cs.columbia.edu/downloads/walle.png",
125
- # "WALL-E,a fire extinguisher",
126
- # "a 3D render of {}.",
127
- # "ours_fast",
128
- # True,
129
- # ],
130
  ],
131
  )
132
  # iface.launch(share=True)
 
24
  ):
25
  image = Image.fromarray(image)
26
  draw = ImageDraw.Draw(image)
27
+ draw.text(
28
+ position,
29
+ text,
30
+ fill=color,
31
+ font=ImageFont.truetype(
32
+ "/usr/share/fonts/truetype/lato/Lato-Medium.ttf", fontsize
33
+ ),
34
+ )
 
 
 
35
  return np.array(image)
36
 
37
 
 
103
  "ours_fast",
104
  True,
105
  ],
106
+ [
107
+ "https://semantic-abstraction.cs.columbia.edu/downloads/livingroom.png",
108
+ "monopoly boardgame set,door knob,sofa,coffee table,plant,carpet,wall",
109
+ "a photograph of a {} in a home.",
110
+ "ours_fast",
111
+ True,
112
+ ],
113
+ [
114
+ "https://semantic-abstraction.cs.columbia.edu/downloads/fireplace.png",
115
+ "fireplace,beige armchair,candle,large indoor plant in a pot,forest painting,cheetah-patterned pillow,floor,carpet,wall",
116
+ "a photograph of a {} in a home.",
117
+ "ours_fast",
118
+ True,
119
+ ],
120
+ [
121
+ "https://semantic-abstraction.cs.columbia.edu/downloads/walle.png",
122
+ "WALL-E,a fire extinguisher",
123
+ "a 3D render of {}.",
124
+ "ours_fast",
125
+ True,
126
+ ],
127
  ],
128
  )
129
  # iface.launch(share=True)