schroneko commited on
Commit
142b81d
1 Parent(s): 46358a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -14,7 +14,8 @@ dtype = torch.bfloat16
14
 
15
  quantization_config = BitsAndBytesConfig(load_in_8bit=True)
16
 
17
- def load_model():
 
18
  tokenizer = AutoTokenizer.from_pretrained(model_id, token=huggingface_token)
19
  model = AutoModelForCausalLM.from_pretrained(
20
  model_id,
@@ -24,12 +25,7 @@ def load_model():
24
  token=huggingface_token,
25
  low_cpu_mem_usage=True
26
  )
27
- return tokenizer, model
28
-
29
- tokenizer, model = load_model()
30
 
31
- @spaces.GPU
32
- def moderate(user_input, assistant_response):
33
  chat = [
34
  {"role": "user", "content": user_input},
35
  {"role": "assistant", "content": assistant_response},
 
14
 
15
  quantization_config = BitsAndBytesConfig(load_in_8bit=True)
16
 
17
+ @spaces.GPU
18
+ def moderate(user_input, assistant_response):
19
  tokenizer = AutoTokenizer.from_pretrained(model_id, token=huggingface_token)
20
  model = AutoModelForCausalLM.from_pretrained(
21
  model_id,
 
25
  token=huggingface_token,
26
  low_cpu_mem_usage=True
27
  )
 
 
 
28
 
 
 
29
  chat = [
30
  {"role": "user", "content": user_input},
31
  {"role": "assistant", "content": assistant_response},