Spaces:
Sleeping
Sleeping
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() | |
def display_data(): | |
return df.to_csv() | |
def display_continents(): | |
continents = home_page.display_continents(df) | |
return continents.tolist() | |
def display_countries(): | |
countries = home_page.display_countries(df) | |
return countries.tolist() | |
def display_continent_stats(attribute:str, stat_type:str): | |
continent_stats = home_page.continent_stat(df, attribute, stat_type) | |
return continent_stats | |
def display_country_stats(attribute : str, stat_type : str): | |
country_stats = home_page.country_stat(df, attribute,stat_type) | |
return country_stats |