Umairbdxn commited on
Commit
624d037
·
verified ·
1 Parent(s): bf1dca6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -1,4 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from frontend.webui.hf_demo import start_demo_text_to_image
2
 
3
  print("Starting HF demo text to image")
4
- start_demo_text_to_image(False)
 
 
1
+ import os
2
+
3
+ # --- STEP 1: SAFETY FILTER HACK START ---
4
+ os.environ["SAFETY_CHECKER"] = "False"
5
+ os.environ["DISABLE_SAFETY_CHECKER"] = "1"
6
+
7
+ try:
8
+ # Hum Diffusers library ko 'Hack' kar rahe hain taake wo hamesha "Safe" report kare
9
+ from diffusers.pipelines.stable_diffusion import safety_checker
10
+ def dummy_safety_checker(self, clip_input, images):
11
+ return images, [False] * len(images)
12
+ safety_checker.StableDiffusionSafetyChecker.forward = dummy_safety_checker
13
+ print("NSFW Filter has been disabled successfully!")
14
+ except Exception as e:
15
+ print(f"Could not disable safety checker: {e}")
16
+ # --- STEP 1: SAFETY FILTER HACK END ---
17
+
18
+
19
+ # --- STEP 2: ORIGINAL APP START ---
20
  from frontend.webui.hf_demo import start_demo_text_to_image
21
 
22
  print("Starting HF demo text to image")
23
+ # Yeh false shayad 'share' setting hai, isko aise hi rehne dein
24
+ start_demo_text_to_image(False)