Rishi Desai commited on
Commit
6f68b9e
·
1 Parent(s): d755ae2

examples; install global var

Browse files
demo.py CHANGED
@@ -1,5 +1,13 @@
1
  from install import install
2
- install()
 
 
 
 
 
 
 
 
3
  import gradio as gr
4
  import os
5
  import tempfile
@@ -111,7 +119,7 @@ def create_gradio_interface():
111
  ### Instructions
112
  1. Upload the target image you want to enhance
113
  2. Upload a high-quality reference face image
114
- 3. Click 'Enhance Face' to start the process
115
 
116
  Processing takes about 60 seconds. Due to the constraints of this demo, face cropping and upscaling are not applied to the reference image.
117
  """, elem_id="instructions")
@@ -137,12 +145,13 @@ def create_gradio_interface():
137
  )
138
 
139
  # Add examples using gr.Examples
140
- gr.Markdown("## Examples")
141
  example_inps = [
142
  ["examples/dany_gpt_1.png", "examples/dany_face.jpg"],
143
  ["examples/dany_gpt_2.png", "examples/dany_face.jpg"],
144
  ["examples/tim_gpt_1.png", "examples/tim_face.jpg"],
145
  ["examples/tim_gpt_2.png", "examples/tim_face.jpg"],
 
146
  ]
147
  gr.Examples(examples=example_inps, inputs=[input_image, ref_image], outputs=output_image)
148
 
 
1
  from install import install
2
+
3
+ # Global variable to track if install() has been run
4
+ INSTALLED = False
5
+
6
+ # Check if install() has been run before calling it
7
+ if not INSTALLED:
8
+ install()
9
+ INSTALLED = True
10
+
11
  import gradio as gr
12
  import os
13
  import tempfile
 
119
  ### Instructions
120
  1. Upload the target image you want to enhance
121
  2. Upload a high-quality reference face image
122
+ 3. Click 'Enhance Face' to start the processing
123
 
124
  Processing takes about 60 seconds. Due to the constraints of this demo, face cropping and upscaling are not applied to the reference image.
125
  """, elem_id="instructions")
 
145
  )
146
 
147
  # Add examples using gr.Examples
148
+ gr.Markdown("## Examples\nClick on an example to load the images into the interface.")
149
  example_inps = [
150
  ["examples/dany_gpt_1.png", "examples/dany_face.jpg"],
151
  ["examples/dany_gpt_2.png", "examples/dany_face.jpg"],
152
  ["examples/tim_gpt_1.png", "examples/tim_face.jpg"],
153
  ["examples/tim_gpt_2.png", "examples/tim_face.jpg"],
154
+ ["examples/elon_gpt.png", "examples/elon_face.png"],
155
  ]
156
  gr.Examples(examples=example_inps, inputs=[input_image, ref_image], outputs=output_image)
157
 
examples/elon_face.png ADDED

Git LFS Details

  • SHA256: 3fda092a303ba1a1df911f531e65c772bce6d7bc7b329390d4e83bccaef435cf
  • Pointer size: 132 Bytes
  • Size of remote file: 1.87 MB
examples/{tim_gpt_1 → tim_gpt_1.png} RENAMED
File without changes