Spaces:
Running
Running
temp-9384289
commited on
Commit
•
49010bb
1
Parent(s):
b792f39
desc
Browse files- app.py +16 -3
- requirements.txt +1 -0
app.py
CHANGED
@@ -13,6 +13,7 @@ from PIL import Image
|
|
13 |
from huggingface_hub import from_pretrained_keras
|
14 |
from math import sqrt, ceil
|
15 |
import numpy as np
|
|
|
16 |
import gradio as gr
|
17 |
|
18 |
modelieo=[
|
@@ -196,11 +197,21 @@ def TextToImage(Prompt,inference_steps, model):
|
|
196 |
|
197 |
return [ai_gen, another_one]
|
198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
|
200 |
with gr.Blocks() as app:
|
201 |
|
202 |
interface = gr.Interface(fn=TextToImage,
|
203 |
-
inputs=[gr.Textbox(show_label=True, label='How many seconds to hunt for copies?',), gr.Slider(1, 1000, label='Inference Steps', value=
|
204 |
outputs=gr.Gallery(label="Generated image", show_label=True, elem_id="gallery", columns=[2], rows=[1], object_fit="contain", height="auto"),
|
205 |
# css="#output_image{width: 256px !important; height: 256px !important;}",
|
206 |
title='Unconditional Image Generation',
|
@@ -209,11 +220,13 @@ with gr.Blocks() as app:
|
|
209 |
"<hr>"
|
210 |
"<h1><center>Do machine learing models store protected content?</center></h1>" +
|
211 |
"<p><center><span style='color: red;'>Enter a time to hunt for copies (seconds), select a model, and hit submit!</center></p>" +
|
212 |
-
"<p><center><strong>These image generation models will give you a 'bespoke' generation ❤ of an MNIST hand-drawn digit
|
213 |
"<p><center>then the program will search in training data (for <i>n</i> seconds) to find similar images: <a href='https://medium.com/@mygreatlearning/rmse-what-does-it-mean-2d446c0b1d0e'>RMSE<a>, lower is more similar</p>" +
|
214 |
-
"<p><a href='https://nathanreitinger.umiacs.io'>@nathanReitinger
|
215 |
)
|
216 |
|
|
|
|
|
217 |
app.queue().launch()
|
218 |
# interface.launch(share=True)
|
219 |
|
|
|
13 |
from huggingface_hub import from_pretrained_keras
|
14 |
from math import sqrt, ceil
|
15 |
import numpy as np
|
16 |
+
import pandas as pd
|
17 |
import gradio as gr
|
18 |
|
19 |
modelieo=[
|
|
|
197 |
|
198 |
return [ai_gen, another_one]
|
199 |
|
200 |
+
df = pd.DataFrame({
|
201 |
+
"Model" : ['MNIST-diffusion', 'MNIST-diffusion-oneImage', 'MNIST-GAN', 'MNIST-GAN-noDropout'],
|
202 |
+
"Class (Architecture)" : ['UNet2DModel', 'UNet2DModel', 'Sequential', 'Sequential'],
|
203 |
+
"Dataset Examples" : [60000, 1, 60000, 60000],
|
204 |
+
"Training Loops" : [300, 100000, 90000, 90000],
|
205 |
+
"Notes" : ['Similar architecture as Stable Diffusion, different training data', 'Toy model, purposed to store protected content', 'GANs are not as likely to store protected content', 'Attempting to increase copying']
|
206 |
+
})
|
207 |
+
|
208 |
+
# Applying style to highlight the maximum value in each row
|
209 |
+
styler = df#.style.highlight_max(color = 'lightgreen', axis = 0)
|
210 |
|
211 |
with gr.Blocks() as app:
|
212 |
|
213 |
interface = gr.Interface(fn=TextToImage,
|
214 |
+
inputs=[gr.Textbox(show_label=True, label='How many seconds to hunt for copies?',), gr.Slider(1, 1000, label='Inference Steps (leave unchanged for default, best is 1000 but it is slow!)', value=10, step=1), gr.Dropdown(modelieo)],
|
215 |
outputs=gr.Gallery(label="Generated image", show_label=True, elem_id="gallery", columns=[2], rows=[1], object_fit="contain", height="auto"),
|
216 |
# css="#output_image{width: 256px !important; height: 256px !important;}",
|
217 |
title='Unconditional Image Generation',
|
|
|
220 |
"<hr>"
|
221 |
"<h1><center>Do machine learing models store protected content?</center></h1>" +
|
222 |
"<p><center><span style='color: red;'>Enter a time to hunt for copies (seconds), select a model, and hit submit!</center></p>" +
|
223 |
+
"<p><center><strong>These image generation models will give you a 'bespoke' generation ❤ of an <a href='https://paperswithcode.com/dataset/mnist'>MNIST hand-drawn digit<a></p> " +
|
224 |
"<p><center>then the program will search in training data (for <i>n</i> seconds) to find similar images: <a href='https://medium.com/@mygreatlearning/rmse-what-does-it-mean-2d446c0b1d0e'>RMSE<a>, lower is more similar</p>" +
|
225 |
+
"<p><a href='https://nathanreitinger.umiacs.io'>@nathanReitinger</a></p>"
|
226 |
)
|
227 |
|
228 |
+
gr.Dataframe(styler)
|
229 |
+
|
230 |
app.queue().launch()
|
231 |
# interface.launch(share=True)
|
232 |
|
requirements.txt
CHANGED
@@ -6,6 +6,7 @@ huggingface-hub==0.22.2
|
|
6 |
image-similarity-measures==0.3.6
|
7 |
matplotlib==3.8.4
|
8 |
numpy==1.25.2
|
|
|
9 |
pillow==10.3.0
|
10 |
requests==2.31.0
|
11 |
tensorflow==2.11.0
|
|
|
6 |
image-similarity-measures==0.3.6
|
7 |
matplotlib==3.8.4
|
8 |
numpy==1.25.2
|
9 |
+
pandas==2.2.2
|
10 |
pillow==10.3.0
|
11 |
requests==2.31.0
|
12 |
tensorflow==2.11.0
|