fffiloni commited on
Commit
15b5243
·
1 Parent(s): 19d4107

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -11,17 +11,17 @@ model_id = "CompVis/stable-diffusion-v1-4"
11
  device = "cuda"
12
 
13
  #If you are running this code locally, you need to either do a 'huggingface-cli login` or paste your User Access Token from here https://huggingface.co/settings/tokens into the use_auth_token field below.
14
- pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=False, revision="fp16", torch_dtype=torch.float16)
15
  pipe = pipe.to(device)
16
  #When running locally, you won`t have access to this, so you can remove this part
17
- word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
18
- word_list = word_list_dataset["train"]['text']
19
 
20
  def infer(prompt, samples, steps, scale, seed):
21
  #When running locally you can also remove this filter
22
- for filter in word_list:
23
- if re.search(rf"\b{filter}\b", prompt):
24
- raise gr.Error("Unsafe content found. Please try again with different prompts.")
25
 
26
  generator = torch.Generator(device=device).manual_seed(seed)
27
 
 
11
  device = "cuda"
12
 
13
  #If you are running this code locally, you need to either do a 'huggingface-cli login` or paste your User Access Token from here https://huggingface.co/settings/tokens into the use_auth_token field below.
14
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token="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", revision="fp16", torch_dtype=torch.float16)
15
  pipe = pipe.to(device)
16
  #When running locally, you won`t have access to this, so you can remove this part
17
+ #word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
18
+ #word_list = word_list_dataset["train"]['text']
19
 
20
  def infer(prompt, samples, steps, scale, seed):
21
  #When running locally you can also remove this filter
22
+ #for filter in word_list:
23
+ # if re.search(rf"\b{filter}\b", prompt):
24
+ # raise gr.Error("Unsafe content found. Please try again with different prompts.")
25
 
26
  generator = torch.Generator(device=device).manual_seed(seed)
27