Spaces:
Sleeping
Sleeping
martinsinnona
commited on
Commit
·
a1cce6c
1
Parent(s):
242025e
app.py
CHANGED
|
@@ -27,14 +27,14 @@ def generate(image):
|
|
| 27 |
vega = string_to_vega(generated_caption)
|
| 28 |
vega_image = draw_vega(vega)
|
| 29 |
|
| 30 |
-
return generated_caption, vega_image
|
| 31 |
|
| 32 |
def draw_vega(vega, scale=3):
|
| 33 |
|
| 34 |
spec = json.dumps(vega, indent=4)
|
| 35 |
png_data = vlc.vegalite_to_png(vl_spec=spec, scale=scale)
|
| 36 |
|
| 37 |
-
return Image.open(BytesIO(png_data))
|
| 38 |
|
| 39 |
def string_to_vega(string):
|
| 40 |
|
|
|
|
| 27 |
vega = string_to_vega(generated_caption)
|
| 28 |
vega_image = draw_vega(vega)
|
| 29 |
|
| 30 |
+
return generated_caption, vega_image
|
| 31 |
|
| 32 |
def draw_vega(vega, scale=3):
|
| 33 |
|
| 34 |
spec = json.dumps(vega, indent=4)
|
| 35 |
png_data = vlc.vegalite_to_png(vl_spec=spec, scale=scale)
|
| 36 |
|
| 37 |
+
return Image.open(BytesIO(png_data)).thumbnail((500,500))
|
| 38 |
|
| 39 |
def string_to_vega(string):
|
| 40 |
|