Maheen001 commited on
Commit
35491df
·
verified ·
1 Parent(s): da51f27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -25
app.py CHANGED
@@ -27,7 +27,7 @@ agent = LifeAdminAgent()
27
  print("✓ Agent initialized successfully!")
28
 
29
  # -------------------------------------------
30
- # CUSTOM CSS (Gradio 6: must be injected)
31
  # -------------------------------------------
32
  custom_css = """
33
  <style>
@@ -37,6 +37,7 @@ custom_css = """
37
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
38
  max-width: 1400px !important;
39
  }
 
40
  /* Header styling */
41
  .header-container {
42
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
@@ -52,18 +53,8 @@ custom_css = """
52
  font-weight: 700;
53
  }
54
 
55
- /* Tool card */
56
- .tool-card {
57
- border: 2px solid #e2e8f0;
58
- border-radius: 0.75rem;
59
- padding: 1.25rem;
60
- background: white;
61
- margin: 0.5rem 0;
62
- transition: all .3s;
63
- }
64
  .tool-card:hover {
65
  border-color: #667eea;
66
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
67
  transform: translateY(-2px);
68
  }
69
 
@@ -83,7 +74,7 @@ custom_css = """
83
  """
84
 
85
  # ---------------------------------------------------------
86
- # Create Gradio App (REMOVED: theme= , css= UNUSABLE NOW)
87
  # ---------------------------------------------------------
88
  def create_app():
89
  app = gr.Blocks(
@@ -92,19 +83,18 @@ def create_app():
92
  )
93
 
94
  with app:
95
- # Inject CSS into the top of the app
96
  gr.HTML(custom_css)
97
 
98
- # --- HEADER ---
99
  with gr.Row():
100
  gr.HTML("""
101
- <div class="header-container">
102
- <h1>🤖 LifeAdmin AI</h1>
103
- <p>Your Autonomous Life Management Agent</p>
104
- </div>
105
  """)
106
 
107
- # --- MAIN TABS ---
108
  with gr.Tabs():
109
 
110
  # Manual Dashboard
@@ -119,7 +109,7 @@ def create_app():
119
 
120
  # About
121
  with gr.Tab("ℹ️ About"):
122
- gr.Markdown("### About LifeAdmin AI\nComplete documentation here...")
123
 
124
  # Footer
125
  gr.HTML("""
@@ -145,11 +135,11 @@ if __name__ == "__main__":
145
  setup_llm_fallback()
146
  print("✓ LLM providers configured!")
147
  except Exception as e:
148
- print(f"⚠️ Warning: {e}")
149
 
150
  print("\n🎤 Checking voice requirements...")
151
- print("✓ ElevenLabs API found" if os.getenv("ELEVENLABS_API_KEY") else "⚠️ Missing ElevenLabs API")
152
- print("✓ Groq API found" if os.getenv("GROQ_API_KEY") else "⚠️ Missing Groq API")
153
 
154
  print("\n🎨 Creating Gradio interface...")
155
  app = create_app()
@@ -157,9 +147,9 @@ if __name__ == "__main__":
157
  print("\n✅ LifeAdmin AI is ready!")
158
  print("📱 Open: http://localhost:7860")
159
 
 
160
  app.launch(
161
  server_name="0.0.0.0",
162
  server_port=int(os.getenv("GRADIO_SERVER_PORT", 7860)),
163
- show_error=True,
164
- show_api=False
165
  )
 
27
  print("✓ Agent initialized successfully!")
28
 
29
  # -------------------------------------------
30
+ # CUSTOM CSS (Injected manually)
31
  # -------------------------------------------
32
  custom_css = """
33
  <style>
 
37
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
38
  max-width: 1400px !important;
39
  }
40
+
41
  /* Header styling */
42
  .header-container {
43
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
 
53
  font-weight: 700;
54
  }
55
 
 
 
 
 
 
 
 
 
 
56
  .tool-card:hover {
57
  border-color: #667eea;
 
58
  transform: translateY(-2px);
59
  }
60
 
 
74
  """
75
 
76
  # ---------------------------------------------------------
77
+ # Create Gradio App (NO css= , NO theme= arguments)
78
  # ---------------------------------------------------------
79
  def create_app():
80
  app = gr.Blocks(
 
83
  )
84
 
85
  with app:
 
86
  gr.HTML(custom_css)
87
 
88
+ # Header
89
  with gr.Row():
90
  gr.HTML("""
91
+ <div class="header-container">
92
+ <h1>🤖 LifeAdmin AI</h1>
93
+ <p>Your Autonomous Life Management Agent</p>
94
+ </div>
95
  """)
96
 
97
+ # Tabs
98
  with gr.Tabs():
99
 
100
  # Manual Dashboard
 
109
 
110
  # About
111
  with gr.Tab("ℹ️ About"):
112
+ gr.Markdown("### About LifeAdmin AI\nDocumentation...")
113
 
114
  # Footer
115
  gr.HTML("""
 
135
  setup_llm_fallback()
136
  print("✓ LLM providers configured!")
137
  except Exception as e:
138
+ print("⚠️ Warning:", e)
139
 
140
  print("\n🎤 Checking voice requirements...")
141
+ print("✓ ElevenLabs API found" if os.getenv("ELEVENLABS_API_KEY") else "⚠️ Missing ElevenLabs")
142
+ print("✓ Groq API found" if os.getenv("GROQ_API_KEY") else "⚠️ Missing Groq")
143
 
144
  print("\n🎨 Creating Gradio interface...")
145
  app = create_app()
 
147
  print("\n✅ LifeAdmin AI is ready!")
148
  print("📱 Open: http://localhost:7860")
149
 
150
+ # ⭐ FIX: Removed invalid argument show_api
151
  app.launch(
152
  server_name="0.0.0.0",
153
  server_port=int(os.getenv("GRADIO_SERVER_PORT", 7860)),
154
+ show_error=True
 
155
  )