Spaces:
Sleeping
Sleeping
Update app.py
Browse files3 unmodified lines456789101 unmodified line121314151617184 unmodified lines23242526272829303132333435363738394041422 unmodified lines45464748495051523 unmodified lines56575859606162633 unmodified linesdef add_contact(name, phone, email):if not name:return contacts, "Please enter a name."contacts.append({"Name": name,1 unmodified line"Email": email})return contacts, "Contact added successfully."def search_contact(name):result = [c for c in contacts if name.lower() in c["Name"].lower()]4 unmodified linescontacts = [c for c in contacts if c["Name"].lower() != name.lower()]return contactswith gr.Blocks(title="Contact Management System") as demo:gr.Markdown("# Contact Management System")gr.Markdown("Manage contacts using Python and Gradio.")with gr.Tab("Add Contact"):name = gr.Textbox(label="Name")phone = gr.Textbox(label="Phone")email = gr.Textbox(label="Email")add_btn = gr.Button("Add Contact")table = gr.JSON(label="Contacts")status = gr.Textbox(label="Status")add_btn.click(add_contact,2 unmodified lines)with gr.Tab("Search Contact"):search_name = gr.Textbox(label="Search by Name")search_btn = gr.Button("Search")search_result = gr.JSON(label="Result")search_btn.click(3 unmodified lines)with gr.Tab("Delete Contact"):delete_name = gr.Textbox(label="Name")delete_btn = gr.Button("Delete")delete_table = gr.JSON(label="Contacts")delete_btn.click(3 unmodified lines456789101 unmodified line121314151617184 unmodified lines232425262728293031323334353637383940414243444546474849502 unmodified lines53545556575859603 unmodified lines64656667686970713 unmodified linesdef add_contact(name, phone, email):if not name:return contacts, " Please enter a name."contacts.append({"Name": name,1 unmodified line"Email": email})return contacts, " Contact added successfully."def search_contact(name):result = [c for c in contacts if name.lower() in c["Name"].lower()]4 unmodified linescontacts = [c for c in contacts if c["Name"].lower() != name.lower()]return contacts# ---------- الثيم: هنا بنحدد شكل الألوان والحواف ----------theme = gr.themes.Monochrome()with gr.Blocks(title="Contact Management System", theme=theme) as demo:gr.Markdown("""# Contact Management SystemManage your contacts easily using Python and Gradio.""")with gr.Tab("Add Contact"):with gr.Group():name = gr.Textbox(label="Name", placeholder="e.g. Ahmed Ali")phone = gr.Textbox(label="Phone", placeholder="e.g. 0790xxxxxxx")email = gr.Textbox(label="Email", placeholder="e.g. ahmed@example.com")add_btn = gr.Button("Add Contact", variant="primary")status = gr.Textbox(label="Status", interactive=False)table = gr.JSON(label="Contacts")add_btn.click(add_contact,2 unmodified lines)with gr.Tab("Search Contact"):search_name = gr.Textbox(label="Search by Name", placeholder="Type a name...")search_btn = gr.Button("Search", variant="primary")search_result = gr.JSON(label="Result")search_btn.click(3 unmodified lines)with gr.Tab("Delete Contact"):delete_name = gr.Textbox(label="Name", placeholder="Exact name to delete")delete_btn = gr.Button("Delete", variant="stop")delete_table = gr.JSON(label="Contacts")delete_btn.click(
app.py+23-15