Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import json
|
|
11 |
import datetime
|
12 |
from pypdf import PdfReader
|
13 |
import uuid
|
14 |
-
|
15 |
from agent import (
|
16 |
PREFIX,
|
17 |
GET_CHART,
|
@@ -433,13 +433,14 @@ def create_image(url):
|
|
433 |
|
434 |
with open("tmp.svg", "rb") as f:
|
435 |
encoded_image = base64.b64encode(f.read())
|
436 |
-
|
|
|
437 |
with open("image.png","wb") as file:
|
438 |
#file.write(eval(encoded_image))
|
439 |
file.write(encoded_image)
|
440 |
#output = cairosvg.svg2png(
|
441 |
# bytestring=open('tmp.svg').read().encode('utf-8'), write_to="output.png")
|
442 |
-
return "
|
443 |
|
444 |
score_js="""
|
445 |
function(text_input) {
|
|
|
11 |
import datetime
|
12 |
from pypdf import PdfReader
|
13 |
import uuid
|
14 |
+
from PIL import Image
|
15 |
from agent import (
|
16 |
PREFIX,
|
17 |
GET_CHART,
|
|
|
433 |
|
434 |
with open("tmp.svg", "rb") as f:
|
435 |
encoded_image = base64.b64encode(f.read())
|
436 |
+
this = Image.open("tmp.svg")
|
437 |
+
out_im = this.save("tmp.png")
|
438 |
with open("image.png","wb") as file:
|
439 |
#file.write(eval(encoded_image))
|
440 |
file.write(encoded_image)
|
441 |
#output = cairosvg.svg2png(
|
442 |
# bytestring=open('tmp.svg').read().encode('utf-8'), write_to="output.png")
|
443 |
+
return "tmp.png"
|
444 |
|
445 |
score_js="""
|
446 |
function(text_input) {
|