mrfakename commited on
Commit
7fdc734
·
1 Parent(s): f7d0046

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -20,9 +20,9 @@ model = AutoModelForCausalLM.from_pretrained(
20
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
21
  trust_remote_code=True,
22
  ).to(device)
23
- mdl = Detoxify('original', device='cuda')
24
  @spaces.GPU(enable_queue=True)
25
  def generate_text(text, temperature, maxLen):
 
26
  if mdl.predict(text)['toxicity'] > 0.7:
27
  raise gr.Error("Sorry, our systems may have detected toxic content. Please try a different input.")
28
  inputs = tokenizer([text], return_tensors="pt").to(device)
 
20
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
21
  trust_remote_code=True,
22
  ).to(device)
 
23
  @spaces.GPU(enable_queue=True)
24
  def generate_text(text, temperature, maxLen):
25
+ mdl = Detoxify('original', device='cuda')
26
  if mdl.predict(text)['toxicity'] > 0.7:
27
  raise gr.Error("Sorry, our systems may have detected toxic content. Please try a different input.")
28
  inputs = tokenizer([text], return_tensors="pt").to(device)