OCILFundFinder / app.py
tjido's picture
Update app.py
2ca7a8c verified
import gradio as gr
# Sample funding opportunities data
funding_programs = [
{
"name": "Education Partnerships Program",
"description": "Promotes collaboration between First Nations, provinces, ISC and other stakeholders to advance First Nations education.",
"deadline": "Annual - February 28",
"focus": "K-12 education systems collaboration",
"amount": "$50,000 - $150,000",
"source": "https://www.sac-isc.gc.ca/eng/1100100033760/1531318318178"
},
{
"name": "Post-Secondary Partnerships Program",
"description": "Supports projects that develop and deliver college/university programs for Indigenous students.",
"deadline": "Annual - December 15",
"focus": "Post-secondary education development",
"amount": "$75,000 - $200,000",
"source": "https://www.sac-isc.gc.ca/eng/1100100033691/1100100033692"
},
{
"name": "Indigenous Languages Funding",
"description": "Supports the preservation and revitalization of Indigenous languages in Canada.",
"deadline": "Annual - April 30",
"focus": "Language documentation, teaching resources, immersion programs",
"amount": "$25,000 - $100,000",
"source": "https://www.sac-isc.gc.ca/eng/1524506968524/1557512776453"
},
{
"name": "Innovation in Education Program",
"description": "Funds innovative approaches to Indigenous education and learning methodologies.",
"deadline": "Annual - April 30, 2025",
"focus": "Educational innovation, technology integration, traditional knowledge",
"amount": "$20,000 - $75,000",
"source": "https://www.sac-isc.gc.ca/eng/1611847976350/1611848008035"
},
{
"name": "First Nations and Inuit Cultural Education Centres",
"description": "Supports cultural education centers that preserve and promote Indigenous heritage.",
"deadline": "Annual - May 5, 2025",
"focus": "Cultural preservation, educational programming, community engagement",
"amount": "$50,000 - $150,000",
"source": "https://www.sac-isc.gc.ca/eng/1100100033700/1531425361344"
},
{
"name": "Emergency Management Assistance Program",
"description": "Helps First Nations prepare for and respond to emergencies affecting reserves.",
"deadline": "Ongoing",
"focus": "Emergency preparedness, response, and recovery",
"amount": "$10,000 - $100,000",
"source": "https://www.sac-isc.gc.ca/eng/1534954090122/1535120506707"
},
{
"name": "First Nation Infrastructure Fund",
"description": "Supports community infrastructure projects on reserve lands.",
"deadline": "Annual - October 31",
"focus": "Community infrastructure improvements",
"amount": "$100,000 - $500,000",
"source": "https://www.sac-isc.gc.ca/eng/1100100010656/1533645154710"
},
{
"name": "Community Opportunity Readiness Program",
"description": "Supports First Nations and Inuit communities with economic opportunities and business development.",
"deadline": "Ongoing",
"focus": "Project development, business plans, marketing",
"amount": "$25,000 - $250,000",
"source": "https://www.sac-isc.gc.ca/eng/1587563567774/1587563589262"
},
{
"name": "Family Violence Prevention Program",
"description": "Supports family violence prevention projects in First Nations communities.",
"deadline": "Annual - January 15",
"focus": "Prevention, awareness, shelter services",
"amount": "$15,000 - $75,000",
"source": "https://www.sac-isc.gc.ca/eng/1100100035253/1533304683142"
},
{
"name": "First Nations Environmental Contaminants Program",
"description": "Addresses concerns about human exposure to environmental contaminants.",
"deadline": "Biennial - September 15",
"focus": "Research, monitoring, risk assessment",
"amount": "$50,000 - $125,000",
"source": "https://www.sac-isc.gc.ca/eng/1583779185601/1583779243216"
}
]
# Function to generate proposal
def generate_proposal(program_name, context_info):
selected_program = None
for program in funding_programs:
if program["name"] == program_name:
selected_program = program
break
if not selected_program:
return "Please select a funding program first."
# Generate proposal based on selected program and additional info
proposal = f"""# Research Proposal: {selected_program['name']}
## Program Information
- **Program:** {selected_program['name']}
- **Deadline:** {selected_program['deadline']}
- **Focus Area:** {selected_program['focus']}
## Project Context
{context_info}
## Project Objectives
- Develop innovative approaches to address challenges in {selected_program['focus']}
- Build capacity within the community and relevant stakeholders
- Create sustainable outcomes with measurable impacts
- Document findings and share knowledge to benefit broader community
## Methodology
The project will employ a mixed-methods approach that centers Indigenous knowledge and perspectives while incorporating relevant best practices from the field. Our methodology will prioritize community engagement, participatory design, and culturally relevant evaluation frameworks.
## Timeline
- **Months 1-3:** Planning, community engagement, and baseline assessment
- **Months 4-8:** Implementation of key activities and regular progress monitoring
- **Months 9-12:** Evaluation, knowledge sharing, and sustainability planning
## Budget Overview
The requested funding will support personnel costs (45%), program activities (30%), materials and equipment (15%), and evaluation (10%). This distribution ensures that adequate resources are allocated to support meaningful community engagement while maintaining administrative efficiency.
## Expected Outcomes
This initiative will directly address community needs related to {selected_program['focus'].lower()}, resulting in tangible benefits including improved services, enhanced capacity, and strengthened community connections. Long-term impacts will include sustained improvements in {selected_program['focus'].lower()} outcomes and enhanced community resilience.
"""
return proposal
# Custom CSS
css = """
body {
font-family: Arial, sans-serif;
}
.header {
background-color: #ee5928;
color: white;
padding: 20px;
border-radius: 8px 8px 0 0;
text-align: center;
margin-bottom: 20px;
font-family: Arial, sans-serif;
}
.step-header {
background-color: #FF5733;
color: white;
padding: 10px 15px;
border-radius: 4px;
margin-top: 10px;
margin-bottom: 15px;
font-family: Arial, sans-serif;
}
.funding-card {
border-left: 4px solid #ee5928;
padding: 15px;
margin: 10px 0;
background-color: #FFF5F2;
border-radius: 4px;
}
.generate-button {
background-color: #ee5928 !important;
color: white !important;
}
"""
# Update the proposal generator function to include funding amount
def generate_proposal(program_name, context_info):
selected_program = None
for program in funding_programs:
if program["name"] == program_name:
selected_program = program
break
if not selected_program:
return "Please select a funding program first."
# Generate proposal based on selected program and additional info
proposal = f"""# Research Proposal: {selected_program['name']}
## Program Information
- **Program:** {selected_program['name']}
- **Deadline:** {selected_program['deadline']}
- **Focus Area:** {selected_program['focus']}
- **Funding Amount:** {selected_program['amount']}
- **Source:** {selected_program['source']}
## Project Context
{context_info}
## Project Objectives
- Develop innovative approaches to address challenges in {selected_program['focus']}
- Build capacity within the community and relevant stakeholders
- Create sustainable outcomes with measurable impacts
- Document findings and share knowledge to benefit broader community
## Methodology
The project will employ a mixed-methods approach that centers Indigenous knowledge and perspectives while incorporating relevant best practices from the field. Our methodology will prioritize community engagement, participatory design, and culturally relevant evaluation frameworks.
## Timeline
- **Months 1-3:** Planning, community engagement, and baseline assessment
- **Months 4-8:** Implementation of key activities and regular progress monitoring
- **Months 9-12:** Evaluation, knowledge sharing, and sustainability planning
## Budget Overview
The requested funding of {selected_program['amount'].split('-')[0]} will support personnel costs (45%), program activities (30%), materials and equipment (15%), and evaluation (10%). This distribution ensures that adequate resources are allocated to support meaningful community engagement while maintaining administrative efficiency.
## Expected Outcomes
This initiative will directly address community needs related to {selected_program['focus'].lower()}, resulting in tangible benefits including improved services, enhanced capacity, and strengthened community connections. Long-term impacts will include sustained improvements in {selected_program['focus'].lower()} outcomes and enhanced community resilience.
"""
return proposal
# Create Gradio interface
with gr.Blocks(css=css) as demo:
# App header
gr.HTML(
"""
<div class="header">
<h1 style="margin: 0; font-size: 2em; color: white;">Funding Proposal Generator</h1>
<p style="margin: 5px 0 0 0; color: white;">Find opportunities from <a href="https://www.sac-isc.gc.ca" style="color: white; text-decoration: underline;">https://www.sac-isc.gc.ca</a> and create research proposals</p>
</div>
"""
)
# Step 1: Display opportunities
gr.HTML(' <div class="step-header"><h2 style="margin: 0; font-size: 1.3em; color: white;">Step 1: Available Funding Opportunities</h2></div>')
opportunities_html = "<div style='max-height: 300px; overflow-y: auto;'>"
for program in funding_programs:
opportunities_html += f"""
<div class="funding-card">
<h3 style="margin-top: 0; color: #ee5928;">{program['name']}</h3>
<p><strong>Description:</strong> {program['description']}</p>
<p><strong>Deadline:</strong> {program['deadline']}</p>
<p><strong>Focus:</strong> {program['focus']}</p>
<p><strong>Funding Amount:</strong> {program['amount']}</p>
<p><strong>Source:</strong> <a href="{program['source']}" target="_blank" style="color: #ee5928;">{program['source']}</a></p>
</div>
"""
opportunities_html += "</div>"
gr.HTML(opportunities_html)
# Step 2: Select opportunity
gr.HTML(' <div class="step-header"><h2 style="margin: 0; font-size: 1.3em; color: white;">Step 2: Select an Opportunity</h2></div>')
program_dropdown = gr.Dropdown(
choices=[program["name"] for program in funding_programs],
label="Select Funding Program",
info="Choose the program you want to apply for"
)
# Step 3: Provide additional information
gr.HTML(' <div class="step-header"><h2 style="margin: 0; font-size: 1.3em; color: white;">Step 3: Provide Project Context</h2></div>')
additional_info = gr.Textbox(
label="Project Context",
placeholder="Describe why you're seeking this funding, your organization's background, and how this project addresses community needs...",
lines=6
)
# Step 4: Generate proposal
gr.HTML(' <div class="step-header"><h2 style="margin: 0; font-size: 1.3em; color: white;">Step 4: Generate Research Proposal</h2></div>')
generate_button = gr.Button("Generate Proposal", elem_classes=["generate-button"])
proposal_output = gr.Markdown("Your proposal will appear here after generation.")
# Connect components
generate_button.click(
generate_proposal,
inputs=[program_dropdown, additional_info],
outputs=proposal_output
)
gr.HTML(
"""
<div style="margin-top: 30px; text-align: center; color: #666;">
<p>This tool was created for the OCIL Conference. For demonstration purposes only.</p>
</div>
"""
)
# Launch the app
if __name__ == "__main__":
demo.launch()