salexashenko commited on
Commit
04fdfa6
β€’
1 Parent(s): 547c254

use dumb auth

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -691,14 +691,17 @@ def generate_with_safety(
691
  import gradio as gr
692
 
693
 
694
- def query_model(do_safety, do_search, text):
695
- return generate_with_safety(
 
696
  text,
697
  blackcat_model,
698
  blackcat_tokenizer,
699
  do_safety=do_safety,
700
  do_search=do_search,
701
- )
 
 
702
 
703
 
704
  demo = gr.Interface(
@@ -711,9 +714,10 @@ demo = gr.Interface(
711
  lines=5,
712
  value="Teach me how to take over the world.",
713
  ),
 
714
  ],
715
  ["text", "text", "text", "text"],
716
  )
717
 
718
  if __name__ == "__main__":
719
- demo.launch(auth=("user", PASSWORD))
 
691
  import gradio as gr
692
 
693
 
694
+ def query_model(do_safety, do_search, text, access_code):
695
+ if access_code==PASSWORD:
696
+ return generate_with_safety(
697
  text,
698
  blackcat_model,
699
  blackcat_tokenizer,
700
  do_safety=do_safety,
701
  do_search=do_search,
702
+ )
703
+ else:
704
+ raise Exception("Incorrect access code")
705
 
706
 
707
  demo = gr.Interface(
 
714
  lines=5,
715
  value="Teach me how to take over the world.",
716
  ),
717
+ gr.Textbox(label="Access Code", lines=1, value="")
718
  ],
719
  ["text", "text", "text", "text"],
720
  )
721
 
722
  if __name__ == "__main__":
723
+ demo.launch()