younesbelkada commited on
Commit
4ae241e
β€’
1 Parent(s): b58734b

try with html to fix links

Browse files
Files changed (2) hide show
  1. app.py +5 -1
  2. utils/constants.py +34 -28
app.py CHANGED
@@ -9,7 +9,7 @@ from yarg import get
9
  from models.stylegan_generator import StyleGANGenerator
10
  from models.stylegan2_generator import StyleGAN2Generator
11
 
12
- from utils.constants import VALID_CHOICES, ENABLE_GPU, MODEL_NAME, OUTPUT_LIST, description, title
13
  from utils.image_manip import tensor_to_pil, concat_images
14
 
15
  def get_generator(model_name):
@@ -52,6 +52,8 @@ def inference(seed, coef, nb_images, list_choices):
52
 
53
  return concatenated_output
54
 
 
 
55
  iface = gr.Interface(
56
  fn=inference,
57
  inputs=[
@@ -89,5 +91,7 @@ iface = gr.Interface(
89
  theme="peach",
90
  description=description,
91
  title=title,
 
 
92
  )
93
  iface.launch()
 
9
  from models.stylegan_generator import StyleGANGenerator
10
  from models.stylegan2_generator import StyleGAN2Generator
11
 
12
+ from utils.constants import VALID_CHOICES, ENABLE_GPU, MODEL_NAME, OUTPUT_LIST, description, title, css, article
13
  from utils.image_manip import tensor_to_pil, concat_images
14
 
15
  def get_generator(model_name):
 
52
 
53
  return concatenated_output
54
 
55
+ # https://huggingface.co/spaces/osanseviero/6DRepNet/blob/main/app.py
56
+
57
  iface = gr.Interface(
58
  fn=inference,
59
  inputs=[
 
91
  theme="peach",
92
  description=description,
93
  title=title,
94
+ css=css,
95
+ article=article
96
  )
97
  iface.launch()
utils/constants.py CHANGED
@@ -15,39 +15,45 @@ OUTPUT_LIST = [
15
  gr.outputs.Image(type="pil", label="Generated Images"),
16
  gr.outputs.Image(type="pil", label="Modified Images"),
17
  ]
18
- description = """
19
- This is an interactive demo of an extension of the <a href="https://genforce.github.io/interfacegan/">CVPR2020 InterfaceGAN paper</a>, by adding other attributes such as Hat, Bald, etc. to the generated images. Here is a step-by-step guide to use this interface:
20
- + 🌾 Select the Random seed you want to use to generate the images
21
- + &#128450; Select the list of attributes you want to modify (of course, you can mix several attributes)
22
- + πŸ›  Select the coefficient of modification (higher value means stronger modification)
23
- + πŸ”₯ Submit!
 
 
24
 
25
- Check the <a href="https://github.com/genforce/interfacegan">original repo</a> as well as the <a href="https://github.com/younesbelkada/interfacegan">extended version of the work</a>.
26
 
 
27
 
28
- &#x2B55; This method is biased on the data it has been trained for attribute recognition. E.g. if you decide to modify the "Bald" attribute on Female faces, the method will turn it into Male faces. Future work may focus more on this direction to try to have unbiased results of the modifications.
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  </center>
31
  </p>
32
  """
33
- # description = """
34
- # <p>
35
- # <center>
36
- # <style type="text/css">
37
- # .nobull {
38
- # list-style-type: none;
39
- # }
40
- # </style>
41
- # This is an interactive demo of an extension of the <a href="https://genforce.github.io/interfacegan/">CVPR2020 InterfaceGAN paper</a>, by adding other attributes such as Hat, Bald, etc. to the generated images. Here is a step-by-step guide to use this interface:
42
- # <ul style="nobull">
43
- # <li>🌾 Select the Random seed you want to use to generate the images</li>
44
- # <li>&#128450; Select the list of attributes you want to modify (of course, you can mix several attributes)</li>
45
- # <li>πŸ›  Select the coefficient of modification (higher value means stronger modification)</li>
46
- # <li>πŸ”₯ Submit!</li>
47
- # </ul>
48
- # Check the <a href="https://github.com/genforce/interfacegan">original repo</a> as well as the <a href="https://github.com/younesbelkada/interfacegan">extended version of the work</a>.
49
 
50
- # </center>
51
- # </p>
52
- # """
53
- title = "InterfaceGAN++ Demo"
 
 
 
 
15
  gr.outputs.Image(type="pil", label="Generated Images"),
16
  gr.outputs.Image(type="pil", label="Modified Images"),
17
  ]
18
+ # description = """
19
+ # This is an interactive demo of an extension of the <a href="https://genforce.github.io/interfacegan/">CVPR2020 InterfaceGAN paper</a>, by adding other attributes such as Hat, Bald, etc. to the generated images. Here is a step-by-step guide to use this interface:
20
+ # + 🌾 Select the Random seed you want to use to generate the images
21
+ # + &#128450; Select the list of attributes you want to modify (of course, you can mix several attributes)
22
+ # + πŸ›  Select the coefficient of modification (higher value means stronger modification)
23
+ # + πŸ”₯ Submit!
24
+
25
+ # Check the <a href="https://github.com/genforce/interfacegan">original repo</a> as well as the <a href="https://github.com/younesbelkada/interfacegan">extended version of the work</a>.
26
 
 
27
 
28
+ # &#x2B55; This method is biased on the data it has been trained for attribute recognition. E.g. if you decide to modify the "Bald" attribute on Female faces, the method will turn it into Male faces. Future work may focus more on this direction to try to have unbiased results of the modifications.
29
 
30
+ # </center>
31
+ # </p>
32
+ # """
33
+ description = """
34
+ <p>
35
+ <center>
36
+ This is an interactive demo of an extension of the <a href="https://genforce.github.io/interfacegan/">CVPR2020 InterfaceGAN paper</a>, by adding other attributes such as Hat, Bald, etc. to the generated images. Here is a step-by-step guide to use this interface:
37
+ <ul>
38
+ <li>🌾 Select the Random seed you want to use to generate the images</li>
39
+ <li>&#128450; Select the list of attributes you want to modify (of course, you can mix several attributes)</li>
40
+ <li>πŸ›  Select the coefficient of modification (higher value means stronger modification)</li>
41
+ <li>πŸ”₯ Submit!</li>
42
+ </ul>
43
+ Check the <a href="https://github.com/genforce/interfacegan">original repo</a> as well as the <a href="https://github.com/younesbelkada/interfacegan">extended version of the work</a>.
44
 
45
  </center>
46
  </p>
47
  """
48
+ css = """
49
+ ul {
50
+ list-style-type: none;
51
+ }
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
+ ul.no-bullets li
54
+ {
55
+ list-style-type: none;
56
+ }
57
+ """
58
+ title = "InterfaceGAN++ Demo"
59
+ article = "<div style='text-align: center;'><a href='https://github.com/genforce/interfacegan' target='_blank'>Original Paper</a> | <a href='https://github.com/younesbelkada/interfacegan' target='_blank'>Extended Version</a></div>"