Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,64 +29,53 @@ def search_member(search_term):
|
|
| 29 |
return matches
|
| 30 |
|
| 31 |
def create_about_tab():
|
| 32 |
-
"""Create the About tab content"""
|
| 33 |
with gr.Column():
|
| 34 |
gr.Markdown("""
|
| 35 |
-
# βͺ ODA
|
| 36 |
|
| 37 |
-
**Organisation of Deacons and Acolytes**
|
| 38 |
-
|
| 39 |
-
---
|
| 40 |
|
| 41 |
## π― Mission
|
| 42 |
-
|
| 43 |
|
| 44 |
## ποΈ Vision
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
---
|
| 48 |
-
|
| 49 |
-
## π Our Foundation
|
| 50 |
|
| 51 |
-
|
| 52 |
-
>
|
| 53 |
> **John 13:35**
|
| 54 |
|
| 55 |
-
---
|
| 56 |
-
|
| 57 |
## π€ Services
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
- Spiritual counseling
|
| 63 |
""")
|
| 64 |
|
| 65 |
def create_search_tab():
|
| 66 |
-
"""Create the Search tab content"""
|
| 67 |
with gr.Column():
|
| 68 |
-
gr.Markdown("## π
|
| 69 |
-
gr.Markdown("### Find members in the ODA Nairobi Diocese Welfare Department list")
|
| 70 |
-
gr.Markdown("---")
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
|
| 80 |
results_output = gr.Dataframe(
|
| 81 |
-
|
| 82 |
-
headers=["No.", "Name", "Amount"],
|
| 83 |
datatype=["number", "str", "number"],
|
| 84 |
interactive=False,
|
| 85 |
wrap=True
|
| 86 |
)
|
| 87 |
|
| 88 |
-
status_output = gr.Markdown()
|
| 89 |
-
|
| 90 |
def search_and_display(search_term):
|
| 91 |
result = search_member(search_term)
|
| 92 |
if isinstance(result, str):
|
|
@@ -102,20 +91,28 @@ def create_search_tab():
|
|
| 102 |
search_input.submit(search_and_display, inputs=search_input, outputs=[results_output, status_output])
|
| 103 |
|
| 104 |
def create_app():
|
| 105 |
-
"""Create
|
| 106 |
-
with gr.Blocks(
|
| 107 |
-
|
| 108 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
with gr.Tabs():
|
| 111 |
-
with gr.TabItem("π About
|
| 112 |
create_about_tab()
|
| 113 |
|
| 114 |
-
with gr.TabItem("π
|
| 115 |
create_search_tab()
|
| 116 |
|
| 117 |
return demo
|
| 118 |
|
| 119 |
if __name__ == "__main__":
|
| 120 |
app = create_app()
|
| 121 |
-
app.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
return matches
|
| 30 |
|
| 31 |
def create_about_tab():
|
| 32 |
+
"""Create the About tab content - mobile optimized"""
|
| 33 |
with gr.Column():
|
| 34 |
gr.Markdown("""
|
| 35 |
+
# βͺ ODA Welfare
|
| 36 |
|
| 37 |
+
**Organisation of Deacons and Acolytes**
|
| 38 |
+
Nairobi Diocese
|
|
|
|
| 39 |
|
| 40 |
## π― Mission
|
| 41 |
+
Welfare support for deacons and acolytes, fostering brotherhood and spiritual growth.
|
| 42 |
|
| 43 |
## ποΈ Vision
|
| 44 |
+
No member walks alone in times of need.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
## π Foundation
|
| 47 |
+
> *"Love one another."*
|
| 48 |
> **John 13:35**
|
| 49 |
|
|
|
|
|
|
|
| 50 |
## π€ Services
|
| 51 |
+
β’ Financial assistance
|
| 52 |
+
β’ Medical support
|
| 53 |
+
β’ Educational support
|
| 54 |
+
β’ Spiritual counseling
|
|
|
|
| 55 |
""")
|
| 56 |
|
| 57 |
def create_search_tab():
|
| 58 |
+
"""Create the Search tab content - mobile optimized"""
|
| 59 |
with gr.Column():
|
| 60 |
+
gr.Markdown("## π Search Members")
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
search_input = gr.Textbox(
|
| 63 |
+
placeholder="Enter name (e.g. Abraham)...",
|
| 64 |
+
label="Member Name",
|
| 65 |
+
container=False
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
search_btn = gr.Button("π Search", variant="primary", size="lg", scale=1)
|
| 69 |
+
|
| 70 |
+
status_output = gr.Markdown()
|
| 71 |
|
| 72 |
results_output = gr.Dataframe(
|
| 73 |
+
headers=["#", "Name", "Amount"],
|
|
|
|
| 74 |
datatype=["number", "str", "number"],
|
| 75 |
interactive=False,
|
| 76 |
wrap=True
|
| 77 |
)
|
| 78 |
|
|
|
|
|
|
|
| 79 |
def search_and_display(search_term):
|
| 80 |
result = search_member(search_term)
|
| 81 |
if isinstance(result, str):
|
|
|
|
| 91 |
search_input.submit(search_and_display, inputs=search_input, outputs=[results_output, status_output])
|
| 92 |
|
| 93 |
def create_app():
|
| 94 |
+
"""Create mobile-optimized Gradio interface"""
|
| 95 |
+
with gr.Blocks(
|
| 96 |
+
title="ODA Welfare",
|
| 97 |
+
theme=gr.themes.Soft(),
|
| 98 |
+
css=".gradio-container {max-width: 100% !important; padding: 10px !important;}"
|
| 99 |
+
) as demo:
|
| 100 |
+
gr.Markdown("# βͺ ODA Welfare")
|
| 101 |
+
gr.Markdown("*Nairobi Diocese*")
|
| 102 |
|
| 103 |
with gr.Tabs():
|
| 104 |
+
with gr.TabItem("π About"):
|
| 105 |
create_about_tab()
|
| 106 |
|
| 107 |
+
with gr.TabItem("π Search"):
|
| 108 |
create_search_tab()
|
| 109 |
|
| 110 |
return demo
|
| 111 |
|
| 112 |
if __name__ == "__main__":
|
| 113 |
app = create_app()
|
| 114 |
+
app.launch(
|
| 115 |
+
share=False,
|
| 116 |
+
show_api=False,
|
| 117 |
+
favicon_path=None,
|
| 118 |
+
)
|