Spaces:
Sleeping
Sleeping
Update app.py
Browse files2 unmodified lines3456789101112131415161718192021222324252 unmodified linescontacts = []def add_contact(name, phone, email):contacts.append({"Name": name,"Phone": phone,"Email": email})return contactsdemo = gr.Interface(fn=add_contact,inputs=[gr.Textbox(label="Name"),gr.Textbox(label="Phone"),gr.Textbox(label="Email")],outputs=gr.JSON(label="Contacts"),title="Contact Management System",description="Simple Contact Management System using Python and Gradio")demo.launch()2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768692 unmodified linescontacts = []def add_contact(name, phone, email):if not name:return contacts, "Please enter a name."contacts.append({"Name": name,"Phone": phone,"Email": email})return contacts, "Contact added successfully."def search_contact(name):result = [c for c in contacts if name.lower() in c["Name"].lower()]return resultdef delete_contact(name):global contactscontacts = [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,inputs=[name, phone, email],outputs=[table, status])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(search_contact,inputs=search_name,outputs=search_result)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(delete_contact,inputs=delete_name,outputs=delete_table)demo.launch()
app.py+55-11