mipo57 commited on
Commit
f4f9763
1 Parent(s): eb8c0fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -24
app.py CHANGED
@@ -52,30 +52,31 @@ with gr.Blocks() as demo:
52
 
53
  print("CREDENTIALS:")
54
  print(credentials)
55
-
56
- if credentials == "2024":
57
- gr.ChatInterface(
58
- respond,
59
- additional_inputs=[
60
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
61
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
62
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
63
- gr.Slider(
64
- minimum=0.1,
65
- maximum=1.0,
66
- value=0.95,
67
- step=0.05,
68
- label="Top-p (nucleus sampling)",
69
- ),
70
- ],
71
- )
72
- else:
73
- password = gr.Textbox(placeholder="Provide password...")
74
-
75
- def set_password(password):
76
- return password
77
-
78
- gr.Button("Login").click(set_password, [password], credentials)
 
79
 
80
 
81
  if __name__ == "__main__":
 
52
 
53
  print("CREDENTIALS:")
54
  print(credentials)
55
+ @gr.render(inputs=credentials)
56
+ def app(app_credentials):
57
+ if app_credentials == "2024":
58
+ gr.ChatInterface(
59
+ respond,
60
+ additional_inputs=[
61
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
62
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
63
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
64
+ gr.Slider(
65
+ minimum=0.1,
66
+ maximum=1.0,
67
+ value=0.95,
68
+ step=0.05,
69
+ label="Top-p (nucleus sampling)",
70
+ ),
71
+ ],
72
+ )
73
+ else:
74
+ password = gr.Textbox(placeholder="Provide password...")
75
+
76
+ def set_password(password):
77
+ return password
78
+
79
+ gr.Button("Login").click(set_password, [password], credentials)
80
 
81
 
82
  if __name__ == "__main__":