File size: 1,678 Bytes
fe475ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
import sys
src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..", "main"))
sys.path.append(src_directory)
import requests_app

def choose_data_view(st_interface):
    data_view_options  = [
    "Select an option",
    "Show All Continents",
    "Show All Countries",
    "Show Continent with Highest Population",
    "Show Continent with Lowest Population",
    "Show Country with Highest Population",
    "Show Country with Lowest Population"
    ]
    selected_option = st_interface.selectbox("Select Data to Display", data_view_options)
    return selected_option

def display_contents(option, streamlit):
    try:
        cont = requests_app.get_api(option)
        continents = streamlit.table(cont)
        return continents
    except Exception as e:
        streamlit.error(f"An error occurred while processing the CSV: {e}")

# def display_countries(option, streamlit):
#     cont = requests_app.get_api(option)
#     return streamlit.table(cont)

# def display_continent_with_highest_population(option, streamlit):
#     cont = requests_app.get_api(option)
#     return streamlit.table(cont)

# def display_country_by_continents(selected_continent,streamlit):
#     if selected_continent is not "Choose a continent to display countries":
#             countries_list = requests_app.get_api(selected_continent)
#             streamlit.table(countries_list)

















    # else:
    #         streamlit.warning("Please select a valid continent.")
        #     selected_continent = streamlit.selectbox(
    #     "Select a continent",["Choose a continent to display countries"] + list(df['Continent'].unique()),)