Speedofmastery commited on
Commit
49474e4
Β·
1 Parent(s): 6f6f85f

Auto-commit: app_minimal.py updated

Browse files
Files changed (1) hide show
  1. app_minimal.py +63 -52
app_minimal.py CHANGED
@@ -5,138 +5,149 @@ OpenManus - Minimal HuggingFace Spaces Version
5
 
6
  import gradio as gr
7
 
 
8
  def create_interface():
9
  """Create the main interface"""
10
-
11
  def signup_user(mobile, name, password, confirm_password):
12
  if not all([mobile, name, password, confirm_password]):
13
  return "❌ Please fill in all fields"
14
-
15
  if password != confirm_password:
16
  return "❌ Passwords do not match"
17
-
18
  if len(password) < 6:
19
  return "❌ Password must be at least 6 characters"
20
-
21
  return f"βœ… Account created successfully for {name}! Welcome to OpenManus."
22
-
23
  def login_user(mobile, password):
24
  if not mobile or not password:
25
  return "❌ Please provide mobile number and password"
26
-
27
  return f"βœ… Login successful! Welcome back to OpenManus Platform."
28
-
29
  def chat_with_ai(message, history):
30
  if not message.strip():
31
  return history, ""
32
-
33
  # Simple AI response
34
  response = f"πŸ€– OpenManus AI: Hello! I'm your AI assistant with access to 200+ models including Qwen, DeepSeek, image processing, TTS/STT, and Arabic-English support. You said: '{message}'"
35
-
36
  history.append((message, response))
37
  return history, ""
38
-
39
  # Create the interface
40
  with gr.Blocks(
41
- title="OpenManus - Complete AI Platform",
42
- theme=gr.themes.Soft()
43
  ) as demo:
44
-
45
- gr.HTML("""
 
46
  <div style="text-align: center; padding: 20px; background: linear-gradient(45deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 10px; margin-bottom: 20px;">
47
  <h1>πŸ€– OpenManus - Complete AI Platform</h1>
48
  <p><strong>Mobile Authentication + 200+ AI Models + Cloud Services</strong></p>
49
  <p>Features: Qwen Models | DeepSeek | Image Processing | TTS/STT | Face Swap | Arabic-English</p>
50
  </div>
51
- """)
52
-
 
53
  with gr.Row():
54
  # Authentication Section
55
  with gr.Column(scale=1):
56
  gr.Markdown("## πŸ” Authentication")
57
-
58
  with gr.Tab("Sign Up"):
59
- signup_mobile = gr.Textbox(label="Mobile Number", placeholder="+1234567890")
60
- signup_name = gr.Textbox(label="Full Name", placeholder="Your full name")
 
 
 
 
61
  signup_password = gr.Textbox(label="Password", type="password")
62
- signup_confirm = gr.Textbox(label="Confirm Password", type="password")
 
 
63
  signup_btn = gr.Button("Create Account", variant="primary")
64
  signup_result = gr.Textbox(label="Status", interactive=False)
65
-
66
  signup_btn.click(
67
  signup_user,
68
  [signup_mobile, signup_name, signup_password, signup_confirm],
69
- signup_result
70
  )
71
-
72
  with gr.Tab("Login"):
73
- login_mobile = gr.Textbox(label="Mobile Number", placeholder="+1234567890")
 
 
74
  login_password = gr.Textbox(label="Password", type="password")
75
  login_btn = gr.Button("Login", variant="primary")
76
  login_result = gr.Textbox(label="Status", interactive=False)
77
-
78
  login_btn.click(
79
- login_user,
80
- [login_mobile, login_password],
81
- login_result
82
  )
83
-
84
  # AI Chat Section
85
  with gr.Column(scale=2):
86
  gr.Markdown("## πŸ€– AI Assistant")
87
-
88
  chatbot = gr.Chatbot(height=400, show_copy_button=True)
89
-
90
  with gr.Row():
91
  msg_input = gr.Textbox(
92
- label="Message",
93
  placeholder="Ask me anything! I have 200+ AI models...",
94
- scale=4
95
  )
96
  send_btn = gr.Button("Send", variant="primary", scale=1)
97
-
98
  send_btn.click(chat_with_ai, [msg_input, chatbot], [chatbot, msg_input])
99
- msg_input.submit(chat_with_ai, [msg_input, chatbot], [chatbot, msg_input])
100
-
 
 
101
  # Status Footer
102
- gr.HTML("""
 
103
  <div style="background: #f0f8ff; padding: 15px; border-radius: 10px; margin-top: 20px; text-align: center;">
104
  <h3>πŸ“Š Platform Status</h3>
105
  <p>βœ… Authentication Ready | βœ… AI Models Available | βœ… Platform Active</p>
106
  <p><em>Successfully deployed on HuggingFace Spaces!</em></p>
107
  </div>
108
- """)
109
-
 
110
  return demo
111
 
 
112
  def main():
113
  """Main entry point"""
114
  print("πŸš€ OpenManus Platform Starting...")
115
-
116
  try:
117
  app = create_interface()
118
  print("βœ… Interface created successfully")
119
-
120
- app.launch(
121
- server_name="0.0.0.0",
122
- server_port=7860,
123
- share=False,
124
- show_api=False
125
- )
126
-
127
  except Exception as e:
128
  print(f"❌ Error: {e}")
129
  # Create emergency fallback
130
  with gr.Blocks(title="OpenManus") as fallback:
131
- gr.HTML("""
 
132
  <div style="text-align: center; padding: 50px;">
133
  <h1>πŸ€– OpenManus Platform</h1>
134
  <h2>βœ… Successfully Deployed!</h2>
135
  <p>Complete AI platform with mobile authentication and 200+ models is ready!</p>
136
  </div>
137
- """)
138
-
 
139
  fallback.launch(server_name="0.0.0.0", server_port=7860)
140
 
 
141
  if __name__ == "__main__":
142
- main()
 
5
 
6
  import gradio as gr
7
 
8
+
9
  def create_interface():
10
  """Create the main interface"""
11
+
12
  def signup_user(mobile, name, password, confirm_password):
13
  if not all([mobile, name, password, confirm_password]):
14
  return "❌ Please fill in all fields"
15
+
16
  if password != confirm_password:
17
  return "❌ Passwords do not match"
18
+
19
  if len(password) < 6:
20
  return "❌ Password must be at least 6 characters"
21
+
22
  return f"βœ… Account created successfully for {name}! Welcome to OpenManus."
23
+
24
  def login_user(mobile, password):
25
  if not mobile or not password:
26
  return "❌ Please provide mobile number and password"
27
+
28
  return f"βœ… Login successful! Welcome back to OpenManus Platform."
29
+
30
  def chat_with_ai(message, history):
31
  if not message.strip():
32
  return history, ""
33
+
34
  # Simple AI response
35
  response = f"πŸ€– OpenManus AI: Hello! I'm your AI assistant with access to 200+ models including Qwen, DeepSeek, image processing, TTS/STT, and Arabic-English support. You said: '{message}'"
36
+
37
  history.append((message, response))
38
  return history, ""
39
+
40
  # Create the interface
41
  with gr.Blocks(
42
+ title="OpenManus - Complete AI Platform", theme=gr.themes.Soft()
 
43
  ) as demo:
44
+
45
+ gr.HTML(
46
+ """
47
  <div style="text-align: center; padding: 20px; background: linear-gradient(45deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 10px; margin-bottom: 20px;">
48
  <h1>πŸ€– OpenManus - Complete AI Platform</h1>
49
  <p><strong>Mobile Authentication + 200+ AI Models + Cloud Services</strong></p>
50
  <p>Features: Qwen Models | DeepSeek | Image Processing | TTS/STT | Face Swap | Arabic-English</p>
51
  </div>
52
+ """
53
+ )
54
+
55
  with gr.Row():
56
  # Authentication Section
57
  with gr.Column(scale=1):
58
  gr.Markdown("## πŸ” Authentication")
59
+
60
  with gr.Tab("Sign Up"):
61
+ signup_mobile = gr.Textbox(
62
+ label="Mobile Number", placeholder="+1234567890"
63
+ )
64
+ signup_name = gr.Textbox(
65
+ label="Full Name", placeholder="Your full name"
66
+ )
67
  signup_password = gr.Textbox(label="Password", type="password")
68
+ signup_confirm = gr.Textbox(
69
+ label="Confirm Password", type="password"
70
+ )
71
  signup_btn = gr.Button("Create Account", variant="primary")
72
  signup_result = gr.Textbox(label="Status", interactive=False)
73
+
74
  signup_btn.click(
75
  signup_user,
76
  [signup_mobile, signup_name, signup_password, signup_confirm],
77
+ signup_result,
78
  )
79
+
80
  with gr.Tab("Login"):
81
+ login_mobile = gr.Textbox(
82
+ label="Mobile Number", placeholder="+1234567890"
83
+ )
84
  login_password = gr.Textbox(label="Password", type="password")
85
  login_btn = gr.Button("Login", variant="primary")
86
  login_result = gr.Textbox(label="Status", interactive=False)
87
+
88
  login_btn.click(
89
+ login_user, [login_mobile, login_password], login_result
 
 
90
  )
91
+
92
  # AI Chat Section
93
  with gr.Column(scale=2):
94
  gr.Markdown("## πŸ€– AI Assistant")
95
+
96
  chatbot = gr.Chatbot(height=400, show_copy_button=True)
97
+
98
  with gr.Row():
99
  msg_input = gr.Textbox(
100
+ label="Message",
101
  placeholder="Ask me anything! I have 200+ AI models...",
102
+ scale=4,
103
  )
104
  send_btn = gr.Button("Send", variant="primary", scale=1)
105
+
106
  send_btn.click(chat_with_ai, [msg_input, chatbot], [chatbot, msg_input])
107
+ msg_input.submit(
108
+ chat_with_ai, [msg_input, chatbot], [chatbot, msg_input]
109
+ )
110
+
111
  # Status Footer
112
+ gr.HTML(
113
+ """
114
  <div style="background: #f0f8ff; padding: 15px; border-radius: 10px; margin-top: 20px; text-align: center;">
115
  <h3>πŸ“Š Platform Status</h3>
116
  <p>βœ… Authentication Ready | βœ… AI Models Available | βœ… Platform Active</p>
117
  <p><em>Successfully deployed on HuggingFace Spaces!</em></p>
118
  </div>
119
+ """
120
+ )
121
+
122
  return demo
123
 
124
+
125
  def main():
126
  """Main entry point"""
127
  print("πŸš€ OpenManus Platform Starting...")
128
+
129
  try:
130
  app = create_interface()
131
  print("βœ… Interface created successfully")
132
+
133
+ app.launch(server_name="0.0.0.0", server_port=7860, share=False, show_api=False)
134
+
 
 
 
 
 
135
  except Exception as e:
136
  print(f"❌ Error: {e}")
137
  # Create emergency fallback
138
  with gr.Blocks(title="OpenManus") as fallback:
139
+ gr.HTML(
140
+ """
141
  <div style="text-align: center; padding: 50px;">
142
  <h1>πŸ€– OpenManus Platform</h1>
143
  <h2>βœ… Successfully Deployed!</h2>
144
  <p>Complete AI platform with mobile authentication and 200+ models is ready!</p>
145
  </div>
146
+ """
147
+ )
148
+
149
  fallback.launch(server_name="0.0.0.0", server_port=7860)
150
 
151
+
152
  if __name__ == "__main__":
153
+ main()