clockclock commited on
Commit
62764e2
·
verified ·
1 Parent(s): 7d1a221

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -139,15 +139,38 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
139
  cache_examples=True # Speeds up demo loading
140
  )
141
 
142
- # Create some example files for the demo
143
  import os
144
  from urllib.request import urlretrieve
 
 
145
  os.makedirs("examples", exist_ok=True)
146
- urlretrieve("https://huggingface.co/Organika/sdxl-detector/resolve/main/ai.png", "examples/ai_example_1.png")
147
- urlretrieve("https://huggingface.co/Organika/sdxl-detector/resolve/main/human.png", "examples/human_example_1.jpg")
148
- urlretrieve("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/stable-diffusion-sdxl/sdxl-gfpgan-output.png", "examples/ai_example_2.png")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
 
151
  # --- 5. Launch the App ---
 
152
  if __name__ == "__main__":
153
- demo.launch(debug=True) # debug=True lets you see print statements in the logs
 
139
  cache_examples=True # Speeds up demo loading
140
  )
141
 
142
+ # --- Create example files for the demo ---
143
  import os
144
  from urllib.request import urlretrieve
145
+
146
+ print("Creating examples directory and downloading example images...")
147
  os.makedirs("examples", exist_ok=True)
148
+
149
+ # These URLs are from the stable Hugging Face documentation assets
150
+ try:
151
+ # AI Example 1: A classic AI-generated image (astronaut on a horse)
152
+ urlretrieve(
153
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/horse.png",
154
+ "examples/ai_example_1.png"
155
+ )
156
+
157
+ # Human Example 1: A real photograph
158
+ urlretrieve(
159
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/gradio-guide/zookeeper.png",
160
+ "examples/human_example_1.jpg"
161
+ )
162
+
163
+ # AI Example 2: An AI-generated portrait, good for testing face/hair detection
164
+ urlretrieve(
165
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/blog/stable-diffusion-sdxl/sdxl-gfpgan-output.png",
166
+ "examples/ai_example_2.png"
167
+ )
168
+ print("Example images downloaded successfully.")
169
+ except Exception as e:
170
+ print(f"Failed to download example images: {e}")
171
 
172
 
173
  # --- 5. Launch the App ---
174
+ # This line was already there, just make sure it's the last part of your script
175
  if __name__ == "__main__":
176
+ demo.launch(debug=True)