yadongxie commited on
Commit
2ec09b1
1 Parent(s): ce67688

fix: remove stop button

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -194,14 +194,17 @@ def initial_setup(state):
194
  try:
195
  state.client = create_client(api_key)
196
  test_api_key(state.client) # Test the API key from the environment variable
197
- api_key_status = gr.update(value="Use default API key", visible=True)
 
 
 
198
  api_key_input = gr.update(visible=False)
199
  set_key_button = gr.update(visible=False)
200
  return api_key_status, api_key_input, set_key_button, state
201
  except Exception as e:
202
  # Failed to use the api_key, show input box
203
  api_key_status = gr.update(
204
- value="Failed to use API key from environment variable. Please enter a valid API key.",
205
  visible=True,
206
  )
207
  api_key_input = gr.update(visible=True)
@@ -218,7 +221,7 @@ def initial_setup(state):
218
  with gr.Blocks() as demo:
219
  gr.Markdown("# Lepton AI LLM Voice Mode")
220
  gr.Markdown(
221
- "You can find Lepton AI LLM voice doc [here](https://www.lepton.ai/playground/chat/llama-3.2-3b)"
222
  )
223
  with gr.Row():
224
  with gr.Column(scale=3):
@@ -242,7 +245,6 @@ with gr.Blocks() as demo:
242
  )
243
  output_audio = gr.Audio(label="Output Audio", autoplay=True)
244
  chatbot = gr.Chatbot(label="Conversation", type="messages")
245
- cancel = gr.Button("Stop Conversation", variant="stop")
246
 
247
  state = gr.State(AppState())
248
 
@@ -273,12 +275,5 @@ with gr.Blocks() as demo:
273
  # Update the chatbot with the final conversation
274
  respond.then(lambda s: s.conversation, [state], [chatbot])
275
 
276
- # Add a "Stop Conversation" button
277
- cancel.click(
278
- lambda: (AppState(stopped=True), gr.Audio(recording=False)),
279
- None,
280
- [state, input_audio],
281
- cancels=[respond],
282
- )
283
 
284
  demo.launch()
 
194
  try:
195
  state.client = create_client(api_key)
196
  test_api_key(state.client) # Test the API key from the environment variable
197
+ api_key_status = gr.update(
198
+ value="You are using default Lepton API key, which have 10 requests/min limit",
199
+ visible=True,
200
+ )
201
  api_key_input = gr.update(visible=False)
202
  set_key_button = gr.update(visible=False)
203
  return api_key_status, api_key_input, set_key_button, state
204
  except Exception as e:
205
  # Failed to use the api_key, show input box
206
  api_key_status = gr.update(
207
+ value="Failed to use default API key. Please enter a valid API key.",
208
  visible=True,
209
  )
210
  api_key_input = gr.update(visible=True)
 
221
  with gr.Blocks() as demo:
222
  gr.Markdown("# Lepton AI LLM Voice Mode")
223
  gr.Markdown(
224
+ "You can find Lepton AI LLM voice doc [here](https://www.lepton.ai/playground/chat/llama-3.2-3b) and serverless endpoint API Key [here](https://dashboard.lepton.ai/workspace-redirect/settings/api-tokens)"
225
  )
226
  with gr.Row():
227
  with gr.Column(scale=3):
 
245
  )
246
  output_audio = gr.Audio(label="Output Audio", autoplay=True)
247
  chatbot = gr.Chatbot(label="Conversation", type="messages")
 
248
 
249
  state = gr.State(AppState())
250
 
 
275
  # Update the chatbot with the final conversation
276
  respond.then(lambda s: s.conversation, [state], [chatbot])
277
 
 
 
 
 
 
 
 
278
 
279
  demo.launch()