SHAMIL SHAHBAZ AWAN commited on
Commit
080c680
·
verified ·
1 Parent(s): a12b3cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -25
app.py CHANGED
@@ -5,14 +5,13 @@ from huggingface_hub import InferenceClient
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
  # Function to handle chatbot responses
8
- def respond(
9
- message,
10
- history: list[tuple[str, str]],
11
- system_message,
12
- max_tokens,
13
- temperature,
14
- top_p,
15
- ):
16
  messages = [{"role": "system", "content": system_message}]
17
 
18
  for val in history:
@@ -66,21 +65,6 @@ with gr.Blocks(theme="soft") as demo:
66
  visible=False, # Hide the system message from the display
67
  interactive=False, # Ensure the user cannot interact with it
68
  ),
69
- gr.Slider(
70
- minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"
71
- ),
72
- gr.Slider(
73
- minimum=0.1,
74
- maximum=4.0,
75
- value=0.7,
76
- step=0.1, label="Temperature",
77
- ),
78
- gr.Slider(
79
- minimum=0.1,
80
- maximum=1.0,
81
- value=0.95,
82
- step=0.05, label="Top-p (nucleus sampling)",
83
- ),
84
  ],
85
  )
86
 
@@ -106,8 +90,7 @@ with gr.Blocks(theme="soft") as demo:
106
  border-color: #6fc3df;
107
  }
108
  .gr-slider {
109
- background-color: #e9f7fc;
110
- box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.1);
111
  }
112
  """
113
 
 
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
  # Function to handle chatbot responses
8
+ def respond(message, history: list[tuple[str, str]], system_message):
9
+ # Set default values for max_tokens, temperature, and top_p
10
+ max_tokens = 512
11
+ temperature = 0.7
12
+ top_p = 0.95
13
+
14
+ # Prepare messages for the chat model
 
15
  messages = [{"role": "system", "content": system_message}]
16
 
17
  for val in history:
 
65
  visible=False, # Hide the system message from the display
66
  interactive=False, # Ensure the user cannot interact with it
67
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  ],
69
  )
70
 
 
90
  border-color: #6fc3df;
91
  }
92
  .gr-slider {
93
+ display: none; /* Hides sliders from the interface */
 
94
  }
95
  """
96