leonelhs commited on
Commit
035c6f2
1 Parent(s): a3436c3

init space

Browse files
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .idea/
2
+ __pycache__/
3
+ get.py
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from style_transfer import StyleTransfer
3
+
4
+ style = StyleTransfer()
5
+
6
+
7
+ def predict(content_image, style_image):
8
+ return style.transfer(content_image, style_image)
9
+
10
+
11
+ footer = r"""
12
+ <center>
13
+ <b>
14
+ Demo for <a href='https://www.tensorflow.org/hub/tutorials/tf2_arbitrary_image_stylization'>Style Transfer</a>
15
+ </b>
16
+ </center>
17
+ """
18
+
19
+ coffe = r"""
20
+ <center>
21
+ <a href="https://www.buymeacoffee.com/leonelhs"> <img
22
+ src="https://img.buymeacoffee.com/button-api/?text=Buy me a
23
+ coffee&emoji=&slug=leonelhs&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000
24
+ &coffee_colour=ffffff" /></a>
25
+ </center>
26
+ """
27
+
28
+ with gr.Blocks(title="Style Transfer") as app:
29
+ gr.HTML("<center><h1>Style Transfer</h1></center>")
30
+ gr.HTML("<center><h3>Fast Style Transfer for Arbitrary Styles</h3></center>")
31
+ with gr.Row(equal_height=False):
32
+ with gr.Column():
33
+ content_img = gr.Image(type="filepath", label="Content image")
34
+ style_img = gr.Image(type="filepath", label="Style image")
35
+ run_btn = gr.Button(variant="primary")
36
+ with gr.Column():
37
+ output_img = gr.Image(type="pil", label="Output image")
38
+ gr.ClearButton(components=[content_img, style_img, output_img], variant="stop")
39
+
40
+ run_btn.click(predict, [content_img, style_img], [output_img])
41
+
42
+ with gr.Row():
43
+ blobs_c = [[f"examples/contents/{x:02d}.jpg"] for x in range(1, 4)]
44
+ examples_c = gr.Dataset(components=[content_img], samples=blobs_c)
45
+ examples_c.click(lambda x: x[0], [examples_c], [content_img])
46
+ with gr.Row():
47
+ blobs_s = [[f"examples/styles/{x:02d}.jpg"] for x in range(1, 12)]
48
+ examples_s = gr.Dataset(components=[style_img], samples=blobs_s)
49
+ examples_s.click(lambda x: x[0], [examples_s], [style_img])
50
+
51
+ with gr.Row():
52
+ gr.HTML(footer)
53
+ with gr.Row():
54
+ gr.HTML(coffe)
55
+
56
+ app.launch(share=False, debug=True, show_error=True)
57
+ app.queue()
delf.py ADDED
File without changes
examples/image_a/01.jpg ADDED

Git LFS Details

  • SHA256: 81b69093a05332b05af9a6f151b00f5c877cfb33a8a5451d3ca51590b48af05d
  • Pointer size: 132 Bytes
  • Size of remote file: 7.01 MB
examples/image_a/02.jpg ADDED

Git LFS Details

  • SHA256: cd4bddea41ed8e67f36f25e31e8326c901452a29f6f55d4158b6364ff6b1b917
  • Pointer size: 131 Bytes
  • Size of remote file: 232 kB
examples/image_a/03.jpg ADDED

Git LFS Details

  • SHA256: 6f094ecfea2f273594b5c143cf29f4397ed4867f0371416168b586c83ac9c4a2
  • Pointer size: 132 Bytes
  • Size of remote file: 3.09 MB
examples/image_a/04.jpg ADDED

Git LFS Details

  • SHA256: 56308bd8d13fc418e3c96815c07ed684d89114e2e84e19e4711ffaafcd52f9f1
  • Pointer size: 132 Bytes
  • Size of remote file: 2.08 MB
examples/image_b/01.jpg ADDED

Git LFS Details

  • SHA256: 413f89fcaf50666eb0a55704cb2317ae771afb4f907e7b2653c67b4b1af32af1
  • Pointer size: 133 Bytes
  • Size of remote file: 14.2 MB
examples/image_b/02.jpg ADDED

Git LFS Details

  • SHA256: bb95a5fc2ebd85edce2c7563868219b50607686cf85512d1bd94a326a517af30
  • Pointer size: 130 Bytes
  • Size of remote file: 90.7 kB
examples/image_b/03.jpg ADDED

Git LFS Details

  • SHA256: 211103f11e101a6c9d9858c2aa5badd8ebd109a01163b45790d302fea9928c9e
  • Pointer size: 132 Bytes
  • Size of remote file: 2.64 MB
examples/image_b/04.jpg ADDED

Git LFS Details

  • SHA256: a6c22be2eb213592233e2cc176c33cbab59f763daf7622177bcc90310e79b948
  • Pointer size: 132 Bytes
  • Size of remote file: 4.88 MB
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pillow>=10.0.1
2
+ numpy>=1.23.5
3
+ tensorflow>=2.15.0