muddasser commited on
Commit
be4433b
·
verified ·
1 Parent(s): 1b6ac62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -630,9 +630,14 @@ def _init_state(memory, lang, history):
630
 
631
  def build_app():
632
  # Pre-load welcome audio once
633
- print("⏳ Generating welcome audio…")
634
- welcome_b64 = welcome_audio_b64()
635
- print("✅ Welcome audio ready.")
 
 
 
 
 
636
 
637
  with gr.Blocks(css=CSS, title="Reem — Virtual Call Centre") as demo:
638
 
@@ -890,10 +895,13 @@ def build_app():
890
 
891
  if __name__ == "__main__":
892
  # Pre-warm models
893
- print("⏳ Loading embedder…")
894
- get_embedder()
895
- print("⏳ Pre-loading FAISS index if available…")
896
- get_index()
 
 
 
897
 
898
  demo = build_app()
899
  demo.launch(
 
630
 
631
  def build_app():
632
  # Pre-load welcome audio once
633
+ # Generate welcome audio lazily to avoid startup timeout
634
+ try:
635
+ print("⏳ Generating welcome audio…")
636
+ welcome_b64 = welcome_audio_b64()
637
+ print("✅ Welcome audio ready.")
638
+ except Exception as e:
639
+ print(f"⚠️ Welcome audio failed: {e}")
640
+ welcome_b64 = "" # silent fallback
641
 
642
  with gr.Blocks(css=CSS, title="Reem — Virtual Call Centre") as demo:
643
 
 
895
 
896
  if __name__ == "__main__":
897
  # Pre-warm models
898
+ try:
899
+ print("⏳ Loading embedder…")
900
+ get_embedder()
901
+ print("⏳ Pre-loading FAISS index if available…")
902
+ get_index()
903
+ except Exception as e:
904
+ print(f"⚠️ Preload warning: {e}")
905
 
906
  demo = build_app()
907
  demo.launch(