bluenevus commited on
Commit
8c0d5a5
·
verified ·
1 Parent(s): 1f3942e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -348,6 +348,17 @@ def generate_meeting_minutes(session_dir):
348
  print("Error in generate_meeting_minutes:", e)
349
  return f"Error generating minutes: {e}", None, gr.update(visible=True)
350
 
 
 
 
 
 
 
 
 
 
 
 
351
  # ========== Gradio UI ==========
352
 
353
  nvidia_theme = gr_themes.Default(
@@ -366,18 +377,6 @@ with gr.Blocks(theme=nvidia_theme) as demo:
366
  demo.load(start_session, outputs=[session_dir])
367
 
368
  # ====== Twilio Tab ======
369
- with gr.Tab("Twilio Call & Recording"):
370
- gr.Markdown("### 1. Make Twilio Call and Record")
371
- phone_number = gr.Textbox(label="Phone Number (E.164)", placeholder="+15551234567")
372
- conference_code = gr.Textbox(label="Conference Code (optional)", placeholder="123456#")
373
- call_btn = gr.Button("Make Call")
374
- call_sid = gr.Textbox(label="Call SID", interactive=False)
375
- call_status = gr.Textbox(label="Call Status", interactive=False)
376
- call_btn.click(
377
- make_conference_call,
378
- inputs=[phone_number, conference_code],
379
- outputs=[call_sid, call_status]
380
- )
381
 
382
  with gr.Tab("Twilio Call & Recording"):
383
  gr.Markdown("### 1. Make Twilio Call and Record")
 
348
  print("Error in generate_meeting_minutes:", e)
349
  return f"Error generating minutes: {e}", None, gr.update(visible=True)
350
 
351
+ def hangup_call(call_sid):
352
+ try:
353
+ account_sid, auth_token, _ = get_twilio_credentials()
354
+ if not all([account_sid, auth_token]):
355
+ return "Twilio credentials not found. Please set environment variables."
356
+ client = Client(account_sid, auth_token)
357
+ call = client.calls(call_sid).update(status="completed")
358
+ return f"Call {call_sid} has been hung up."
359
+ except Exception as e:
360
+ return f"Error hanging up call: {str(e)}"
361
+
362
  # ========== Gradio UI ==========
363
 
364
  nvidia_theme = gr_themes.Default(
 
377
  demo.load(start_session, outputs=[session_dir])
378
 
379
  # ====== Twilio Tab ======
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
  with gr.Tab("Twilio Call & Recording"):
382
  gr.Markdown("### 1. Make Twilio Call and Record")