simplyjaga
commited on
Commit
·
7459f84
1
Parent(s):
faadaec
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import model
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
#gui
|
5 |
+
demo = gr.Blocks()
|
6 |
+
with demo:
|
7 |
+
gr.Markdown(
|
8 |
+
"""# Neural Style Transfer Using DenseNet
|
9 |
+
Since running this demo takes too much time without gpu, copy and try it out in the colab with gpu option for nearly 1000 steps to get an pretty decent output
|
10 |
+
""")
|
11 |
+
|
12 |
+
with gr.Row():
|
13 |
+
with gr.Column():
|
14 |
+
input =[gr.Image(label='Style Image', type='pil'),
|
15 |
+
gr.Image(label='Content Image', type='pil'),
|
16 |
+
gr.Slider(0, 1, value=1, label='Alpha (amout of info from content image)'),
|
17 |
+
gr.Slider(0, 1, value=0.02, label='Beta (amout of style from style image)'),
|
18 |
+
gr.Number(label='Step (no.of generation updates) - keep it below 20 because it takes too much time without gpu')]
|
19 |
+
with gr.Column():
|
20 |
+
output = gr.Image(label='Image after Style Transfer')
|
21 |
+
gr.Examples([['examples/style.jpg','examples/content.jpg']],
|
22 |
+
inputs=input)
|
23 |
+
|
24 |
+
btn = gr.Button("Transfer Style")
|
25 |
+
btn.click(fn=model.get_output, inputs=input, outputs=output)
|
26 |
+
|
27 |
+
demo.queue().launch()
|