mipo57 commited on
Commit
4355102
1 Parent(s): 466800f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -47,28 +47,28 @@ def respond(
47
  """
48
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
49
  """
50
- credentials = gr.State("")
51
-
52
- if credentials == getenv("PASSWORD"):
53
- demo = gr.ChatInterface(
54
- respond,
55
- additional_inputs=[
56
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
57
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
58
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
59
- gr.Slider(
60
- minimum=0.1,
61
- maximum=1.0,
62
- value=0.95,
63
- step=0.05,
64
- label="Top-p (nucleus sampling)",
65
- ),
66
- ],
67
- )
68
- else:
69
- with gr.Blocks() as demo:
70
  password = gr.Textbox(placeholder="Provide password...")
71
-
72
  def set_password(new_password):
73
  return new_password
74
 
 
47
  """
48
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
49
  """
50
+ with gr.Blocks() as demo:
51
+ credentials = gr.State("")
52
+
53
+ if credentials == getenv("PASSWORD"):
54
+ gr.ChatInterface(
55
+ respond,
56
+ additional_inputs=[
57
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
58
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
59
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
60
+ gr.Slider(
61
+ minimum=0.1,
62
+ maximum=1.0,
63
+ value=0.95,
64
+ step=0.05,
65
+ label="Top-p (nucleus sampling)",
66
+ ),
67
+ ],
68
+ )
69
+ else:
70
  password = gr.Textbox(placeholder="Provide password...")
71
+
72
  def set_password(new_password):
73
  return new_password
74