Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,14 +12,14 @@ def image_to_parquet(files):
|
|
12 |
|
13 |
for file_info in files:
|
14 |
# Read image
|
15 |
-
with open(file_info
|
16 |
img = Image.open(image_file)
|
17 |
buffered = io.BytesIO()
|
18 |
img.save(buffered, format="PNG")
|
19 |
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
20 |
|
21 |
# Store image data and name
|
22 |
-
image_data.append({"name": file_info
|
23 |
|
24 |
# Create DataFrame
|
25 |
df = pd.DataFrame(image_data)
|
@@ -48,4 +48,4 @@ with gr.Blocks() as demo:
|
|
48 |
|
49 |
convert_button.click(fn=image_to_parquet, inputs=[image_input], outputs=[download_button])
|
50 |
|
51 |
-
demo.launch()
|
|
|
12 |
|
13 |
for file_info in files:
|
14 |
# Read image
|
15 |
+
with open(file_info, "rb") as image_file:
|
16 |
img = Image.open(image_file)
|
17 |
buffered = io.BytesIO()
|
18 |
img.save(buffered, format="PNG")
|
19 |
img_str = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
20 |
|
21 |
# Store image data and name
|
22 |
+
image_data.append({"name": file_info, "data": img_str})
|
23 |
|
24 |
# Create DataFrame
|
25 |
df = pd.DataFrame(image_data)
|
|
|
48 |
|
49 |
convert_button.click(fn=image_to_parquet, inputs=[image_input], outputs=[download_button])
|
50 |
|
51 |
+
demo.launch(share=True)
|