Spaces:
Paused
Paused
Commit
Β·
f95c677
1
Parent(s):
8149e6c
Auto-commit: app.py updated
Browse files
app.py
CHANGED
|
@@ -5,74 +5,80 @@ OpenManus - HuggingFace Spaces Compatible Version
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
|
|
|
| 8 |
def main():
|
| 9 |
"""Main application"""
|
| 10 |
-
|
| 11 |
def signup(mobile, name, password, confirm):
|
| 12 |
if not all([mobile, name, password, confirm]):
|
| 13 |
return "Please fill all fields"
|
| 14 |
if password != confirm:
|
| 15 |
return "Passwords don't match"
|
| 16 |
return f"Account created for {name}!"
|
| 17 |
-
|
| 18 |
def login(mobile, password):
|
| 19 |
if not mobile or not password:
|
| 20 |
return "Please enter mobile and password"
|
| 21 |
return "Login successful!"
|
| 22 |
-
|
| 23 |
def chat(message, history):
|
| 24 |
if not message:
|
| 25 |
return history, ""
|
| 26 |
response = f"OpenManus AI: I received '{message}'. I have 200+ models ready!"
|
| 27 |
history.append((message, response))
|
| 28 |
return history, ""
|
| 29 |
-
|
| 30 |
with gr.Blocks(title="OpenManus") as app:
|
| 31 |
-
|
| 32 |
-
gr.HTML(
|
|
|
|
| 33 |
<div style="text-align: center; padding: 20px; background: #667eea; color: white; border-radius: 10px;">
|
| 34 |
<h1>π€ OpenManus - Complete AI Platform</h1>
|
| 35 |
<p>Mobile Authentication + 200+ AI Models</p>
|
| 36 |
</div>
|
| 37 |
-
"""
|
| 38 |
-
|
|
|
|
| 39 |
with gr.Row():
|
| 40 |
with gr.Column():
|
| 41 |
gr.Markdown("## Authentication")
|
| 42 |
-
|
| 43 |
with gr.Tab("Sign Up"):
|
| 44 |
s_mobile = gr.Textbox(label="Mobile")
|
| 45 |
-
s_name = gr.Textbox(label="Name")
|
| 46 |
s_pass = gr.Textbox(label="Password", type="password")
|
| 47 |
s_confirm = gr.Textbox(label="Confirm", type="password")
|
| 48 |
s_btn = gr.Button("Sign Up")
|
| 49 |
s_result = gr.Textbox(label="Result")
|
| 50 |
s_btn.click(signup, [s_mobile, s_name, s_pass, s_confirm], s_result)
|
| 51 |
-
|
| 52 |
with gr.Tab("Login"):
|
| 53 |
l_mobile = gr.Textbox(label="Mobile")
|
| 54 |
l_pass = gr.Textbox(label="Password", type="password")
|
| 55 |
l_btn = gr.Button("Login")
|
| 56 |
l_result = gr.Textbox(label="Result")
|
| 57 |
l_btn.click(login, [l_mobile, l_pass], l_result)
|
| 58 |
-
|
| 59 |
with gr.Column():
|
| 60 |
gr.Markdown("## AI Chat")
|
| 61 |
-
|
| 62 |
chatbot = gr.Chatbot(height=400)
|
| 63 |
msg = gr.Textbox(label="Message")
|
| 64 |
send = gr.Button("Send")
|
| 65 |
-
|
| 66 |
send.click(chat, [msg, chatbot], [chatbot, msg])
|
| 67 |
msg.submit(chat, [msg, chatbot], [chatbot, msg])
|
| 68 |
-
|
| 69 |
-
gr.HTML(
|
|
|
|
| 70 |
<div style="text-align: center; padding: 15px; background: #f0f8ff; border-radius: 10px; margin-top: 20px;">
|
| 71 |
<p>β
Platform Active | β
200+ Models Ready | β
Authentication Working</p>
|
| 72 |
</div>
|
| 73 |
-
"""
|
| 74 |
-
|
|
|
|
| 75 |
app.launch(server_name="0.0.0.0", server_port=7860)
|
| 76 |
|
|
|
|
| 77 |
if __name__ == "__main__":
|
| 78 |
-
main()
|
|
|
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
+
|
| 9 |
def main():
|
| 10 |
"""Main application"""
|
| 11 |
+
|
| 12 |
def signup(mobile, name, password, confirm):
|
| 13 |
if not all([mobile, name, password, confirm]):
|
| 14 |
return "Please fill all fields"
|
| 15 |
if password != confirm:
|
| 16 |
return "Passwords don't match"
|
| 17 |
return f"Account created for {name}!"
|
| 18 |
+
|
| 19 |
def login(mobile, password):
|
| 20 |
if not mobile or not password:
|
| 21 |
return "Please enter mobile and password"
|
| 22 |
return "Login successful!"
|
| 23 |
+
|
| 24 |
def chat(message, history):
|
| 25 |
if not message:
|
| 26 |
return history, ""
|
| 27 |
response = f"OpenManus AI: I received '{message}'. I have 200+ models ready!"
|
| 28 |
history.append((message, response))
|
| 29 |
return history, ""
|
| 30 |
+
|
| 31 |
with gr.Blocks(title="OpenManus") as app:
|
| 32 |
+
|
| 33 |
+
gr.HTML(
|
| 34 |
+
"""
|
| 35 |
<div style="text-align: center; padding: 20px; background: #667eea; color: white; border-radius: 10px;">
|
| 36 |
<h1>π€ OpenManus - Complete AI Platform</h1>
|
| 37 |
<p>Mobile Authentication + 200+ AI Models</p>
|
| 38 |
</div>
|
| 39 |
+
"""
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
with gr.Row():
|
| 43 |
with gr.Column():
|
| 44 |
gr.Markdown("## Authentication")
|
| 45 |
+
|
| 46 |
with gr.Tab("Sign Up"):
|
| 47 |
s_mobile = gr.Textbox(label="Mobile")
|
| 48 |
+
s_name = gr.Textbox(label="Name")
|
| 49 |
s_pass = gr.Textbox(label="Password", type="password")
|
| 50 |
s_confirm = gr.Textbox(label="Confirm", type="password")
|
| 51 |
s_btn = gr.Button("Sign Up")
|
| 52 |
s_result = gr.Textbox(label="Result")
|
| 53 |
s_btn.click(signup, [s_mobile, s_name, s_pass, s_confirm], s_result)
|
| 54 |
+
|
| 55 |
with gr.Tab("Login"):
|
| 56 |
l_mobile = gr.Textbox(label="Mobile")
|
| 57 |
l_pass = gr.Textbox(label="Password", type="password")
|
| 58 |
l_btn = gr.Button("Login")
|
| 59 |
l_result = gr.Textbox(label="Result")
|
| 60 |
l_btn.click(login, [l_mobile, l_pass], l_result)
|
| 61 |
+
|
| 62 |
with gr.Column():
|
| 63 |
gr.Markdown("## AI Chat")
|
| 64 |
+
|
| 65 |
chatbot = gr.Chatbot(height=400)
|
| 66 |
msg = gr.Textbox(label="Message")
|
| 67 |
send = gr.Button("Send")
|
| 68 |
+
|
| 69 |
send.click(chat, [msg, chatbot], [chatbot, msg])
|
| 70 |
msg.submit(chat, [msg, chatbot], [chatbot, msg])
|
| 71 |
+
|
| 72 |
+
gr.HTML(
|
| 73 |
+
"""
|
| 74 |
<div style="text-align: center; padding: 15px; background: #f0f8ff; border-radius: 10px; margin-top: 20px;">
|
| 75 |
<p>β
Platform Active | β
200+ Models Ready | β
Authentication Working</p>
|
| 76 |
</div>
|
| 77 |
+
"""
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
app.launch(server_name="0.0.0.0", server_port=7860)
|
| 81 |
|
| 82 |
+
|
| 83 |
if __name__ == "__main__":
|
| 84 |
+
main()
|