Spaces:
Runtime error
Runtime error
yiyixuxu
commited on
Commit
•
15b3749
1
Parent(s):
46170b6
add fonts-liberation2 to packages.txt
Browse files- app.py +7 -7
- packages.txt +2 -1
app.py
CHANGED
@@ -116,19 +116,19 @@ def captioned_strip(images, caption=None, times=None, rows=1):
|
|
116 |
img.paste(img_, (i // rows * w, increased_h + (i % rows) * h))
|
117 |
if caption is not None:
|
118 |
draw = ImageDraw.Draw(img)
|
119 |
-
font = ImageFont.load_default()
|
120 |
#font_small = ImageFont.truetype("arial.pil", 12)
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
draw.text((
|
126 |
for i,ts in enumerate(times):
|
127 |
draw.text((
|
128 |
(i % rows) * w + 40 , #column poistion
|
129 |
i // rows * h + 33) # row position
|
130 |
, ts,
|
131 |
-
(255, 255, 255), font=
|
132 |
return img
|
133 |
|
134 |
def run_inference(url, sampling_interval, search_query):
|
|
|
116 |
img.paste(img_, (i // rows * w, increased_h + (i % rows) * h))
|
117 |
if caption is not None:
|
118 |
draw = ImageDraw.Draw(img)
|
119 |
+
#font = ImageFont.load_default()
|
120 |
#font_small = ImageFont.truetype("arial.pil", 12)
|
121 |
+
font = ImageFont.truetype(
|
122 |
+
"/usr/share/fonts/truetype/liberation2/LiberationMono-Bold.ttf", 16
|
123 |
+
)
|
124 |
+
font_small = ImageFont.truetype("/usr/share/fonts/truetype/liberation2/LiberationMono-Bold.ttf", 12)
|
125 |
+
draw.text((60, 3), caption, (255, 255, 255), font=font)
|
126 |
for i,ts in enumerate(times):
|
127 |
draw.text((
|
128 |
(i % rows) * w + 40 , #column poistion
|
129 |
i // rows * h + 33) # row position
|
130 |
, ts,
|
131 |
+
(255, 255, 255), font=font_small)
|
132 |
return img
|
133 |
|
134 |
def run_inference(url, sampling_interval, search_query):
|
packages.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
ffmpeg
|
|
|
|
1 |
+
ffmpeg
|
2 |
+
fonts-liberation2
|