Spaces:
Runtime error
Runtime error
cosmetic changes
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ def convert(file):
|
|
15 |
dataframe = pd.read_parquet(bytes)
|
16 |
|
17 |
# dataframe.to_csv('output.csv')
|
18 |
-
return dataframe
|
19 |
|
20 |
|
21 |
with gr.Blocks() as demo:
|
@@ -24,7 +24,7 @@ with gr.Blocks() as demo:
|
|
24 |
|
25 |
This tool shows the extraction a dataframe hidden inside an image.
|
26 |
|
27 |
-
There are a few ways to hide data
|
28 |
* adding it after the end of the file (after the PNG IEND chunk), so that it gets
|
29 |
ignored by image viewers
|
30 |
* adding it as comments in the PNG file (tEXt chunks)
|
@@ -40,11 +40,11 @@ with gr.Blocks() as demo:
|
|
40 |
channel of the image encodes the data we're interested in.
|
41 |
|
42 |
This means the resulting picture
|
43 |
-
looks **very close to the original image**; and for the data we hide here, it is **
|
44 |
to the naked eye**.
|
45 |
|
46 |
The resulting PNG file will probably get a little bit bigger as a result, since PNG uses compression,
|
47 |
-
which will have a harder time when we have our stolen data injected
|
48 |
not that much of a problem since it stays <100Ko, so it's not that noticeable.
|
49 |
|
50 |
""")
|
@@ -68,10 +68,8 @@ with gr.Blocks() as demo:
|
|
68 |
|
69 |
im.preprocess = preprocess
|
70 |
df_out = gr.Dataframe(
|
71 |
-
label="Output dataframe", max_rows=20, overflow_row_behaviour="paginate"
|
72 |
)
|
73 |
-
# file_out = gr.File(label="Full output CSV file")
|
74 |
-
btn = gr.Button(value="Extract")
|
75 |
gr.Markdown("Click on the example below to get the data from the associated colab notebook :)")
|
76 |
gr.Examples(
|
77 |
examples=["sample-picture.png"],
|
@@ -80,6 +78,8 @@ with gr.Blocks() as demo:
|
|
80 |
fn=convert,
|
81 |
cache_examples=True,
|
82 |
)
|
|
|
|
|
83 |
# demo = gr.Interface(convert, im, im_2)
|
84 |
btn.click(convert, inputs=[im], outputs=[df_out])
|
85 |
|
|
|
15 |
dataframe = pd.read_parquet(bytes)
|
16 |
|
17 |
# dataframe.to_csv('output.csv')
|
18 |
+
return dataframe.head(20)
|
19 |
|
20 |
|
21 |
with gr.Blocks() as demo:
|
|
|
24 |
|
25 |
This tool shows the extraction a dataframe hidden inside an image.
|
26 |
|
27 |
+
There are a few ways to hide data in a PNG file, notably:
|
28 |
* adding it after the end of the file (after the PNG IEND chunk), so that it gets
|
29 |
ignored by image viewers
|
30 |
* adding it as comments in the PNG file (tEXt chunks)
|
|
|
40 |
channel of the image encodes the data we're interested in.
|
41 |
|
42 |
This means the resulting picture
|
43 |
+
looks **very close to the original image**; and for the data we hide here, it is **imperceptible
|
44 |
to the naked eye**.
|
45 |
|
46 |
The resulting PNG file will probably get a little bit bigger as a result, since PNG uses compression,
|
47 |
+
which will have a harder time when we have our stolen data injected in the image. This is
|
48 |
not that much of a problem since it stays <100Ko, so it's not that noticeable.
|
49 |
|
50 |
""")
|
|
|
68 |
|
69 |
im.preprocess = preprocess
|
70 |
df_out = gr.Dataframe(
|
71 |
+
label="Output dataframe (first 20 rows)", max_rows=20, overflow_row_behaviour="paginate"
|
72 |
)
|
|
|
|
|
73 |
gr.Markdown("Click on the example below to get the data from the associated colab notebook :)")
|
74 |
gr.Examples(
|
75 |
examples=["sample-picture.png"],
|
|
|
78 |
fn=convert,
|
79 |
cache_examples=True,
|
80 |
)
|
81 |
+
# file_out = gr.File(label="Full output CSV file")
|
82 |
+
btn = gr.Button(value="Extract")
|
83 |
# demo = gr.Interface(convert, im, im_2)
|
84 |
btn.click(convert, inputs=[im], outputs=[df_out])
|
85 |
|