from fastapi import FastAPI import os import sys src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..","backend")) sys.path.append(src_directory) from modules import home_page app = FastAPI() df = home_page.process_data() @app.get("/") def home(): return home_page.home() @app.get("/continent") def display_continents(): continent = home_page.continent(df) return {"continents":continent} @app.get("/country") def display_country(): country=home_page.country(df) return{"country":country} @app.get("/max_population/{continent_name}") def max_population(continent_name:str): max_population=home_page.max_population(df,continent_name) return {"max_population":max_population} @app.get("/min_population/{continent_name}") def min_population(continent_name:str): min_population=home_page.min_population(df,continent_name) return {"min_population":min_population}