├── .gitignore ├── 2019.csv ├── LICENSE ├── README.md ├── app.py ├── filename.csv ├── filename.png ├── filename1.csv ├── filename1.png ├── query.py ├── requirements.txt └── test.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | -------------------------------------------------------------------------------- /2019.csv: -------------------------------------------------------------------------------- 1 | Overall_rank,Country_or_region,Score,GDP_per_capita,Social_support,Healthy_life_expectancy,Freedom_to_make_life_choices,Generosity,Perceptions_of_corruption 2 | 1,Finland,7.769,1.34,1.587,0.986,0.596,0.153,0.393 3 | 2,Denmark,7.6,1.383,1.573,0.996,0.592,0.252,0.41 4 | 3,Norway,7.554,1.488,1.582,1.028,0.603,0.271,0.341 5 | 4,Iceland,7.494,1.38,1.624,1.026,0.591,0.354,0.118 6 | 5,Netherlands,7.488,1.396,1.522,0.999,0.557,0.322,0.298 7 | 6,Switzerland,7.48,1.452,1.526,1.052,0.572,0.263,0.343 8 | 7,Sweden,7.343,1.387,1.487,1.009,0.574,0.267,0.373 9 | 8,New Zealand,7.307,1.303,1.557,1.026,0.585,0.33,0.38 10 | 9,Canada,7.278,1.365,1.505,1.039,0.584,0.285,0.308 11 | 10,Austria,7.246,1.376,1.475,1.016,0.532,0.244,0.226 12 | 11,Australia,7.228,1.372,1.548,1.036,0.557,0.332,0.29 13 | 12,Costa Rica,7.167,1.034,1.441,0.963,0.558,0.144,0.093 14 | 13,Israel,7.139,1.276,1.455,1.029,0.371,0.261,0.082 15 | 14,Luxembourg,7.09,1.609,1.479,1.012,0.526,0.194,0.316 16 | 15,United Kingdom,7.054,1.333,1.538,0.996,0.45,0.348,0.278 17 | 16,Ireland,7.021,1.499,1.553,0.999,0.516,0.298,0.31 18 | 17,Germany,6.985,1.373,1.454,0.987,0.495,0.261,0.265 19 | 18,Belgium,6.923,1.356,1.504,0.986,0.473,0.16,0.21 20 | 19,United States,6.892,1.433,1.457,0.874,0.454,0.28,0.128 21 | 20,Czech Republic,6.852,1.269,1.487,0.92,0.457,0.046,0.036 22 | 21,United Arab Emirates,6.825,1.503,1.31,0.825,0.598,0.262,0.182 23 | 22,Malta,6.726,1.3,1.52,0.999,0.564,0.375,0.151 24 | 23,Mexico,6.595,1.07,1.323,0.861,0.433,0.074,0.073 25 | 24,France,6.592,1.324,1.472,1.045,0.436,0.111,0.183 26 | 25,Taiwan,6.446,1.368,1.43,0.914,0.351,0.242,0.097 27 | 26,Chile,6.444,1.159,1.369,0.92,0.357,0.187,0.056 28 | 27,Guatemala,6.436,0.8,1.269,0.746,0.535,0.175,0.078 29 | 28,Saudi Arabia,6.375,1.403,1.357,0.795,0.439,0.08,0.132 30 | 29,Qatar,6.374,1.684,1.313,0.871,0.555,0.22,0.167 31 | 30,Spain,6.354,1.286,1.484,1.062,0.362,0.153,0.079 32 | 31,Panama,6.321,1.149,1.442,0.91,0.516,0.109,0.054 33 | 32,Brazil,6.3,1.004,1.439,0.802,0.39,0.099,0.086 34 | 33,Uruguay,6.293,1.124,1.465,0.891,0.523,0.127,0.15 35 | 34,Singapore,6.262,1.572,1.463,1.141,0.556,0.271,0.453 36 | 35,El Salvador,6.253,0.794,1.242,0.789,0.43,0.093,0.074 37 | 36,Italy,6.223,1.294,1.488,1.039,0.231,0.158,0.03 38 | 37,Bahrain,6.199,1.362,1.368,0.871,0.536,0.255,0.11 39 | 38,Slovakia,6.198,1.246,1.504,0.881,0.334,0.121,0.014 40 | 39,Trinidad & Tobago,6.192,1.231,1.477,0.713,0.489,0.185,0.016 41 | 40,Poland,6.182,1.206,1.438,0.884,0.483,0.117,0.05 42 | 41,Uzbekistan,6.174,0.745,1.529,0.756,0.631,0.322,0.24 43 | 42,Lithuania,6.149,1.238,1.515,0.818,0.291,0.043,0.042 44 | 43,Colombia,6.125,0.985,1.41,0.841,0.47,0.099,0.034 45 | 44,Slovenia,6.118,1.258,1.523,0.953,0.564,0.144,0.057 46 | 45,Nicaragua,6.105,0.694,1.325,0.835,0.435,0.2,0.127 47 | 46,Kosovo,6.1,0.882,1.232,0.758,0.489,0.262,0.006 48 | 47,Argentina,6.086,1.092,1.432,0.881,0.471,0.066,0.05 49 | 48,Romania,6.07,1.162,1.232,0.825,0.462,0.083,0.005 50 | 49,Cyprus,6.046,1.263,1.223,1.042,0.406,0.19,0.041 51 | 50,Ecuador,6.028,0.912,1.312,0.868,0.498,0.126,0.087 52 | 51,Kuwait,6.021,1.5,1.319,0.808,0.493,0.142,0.097 53 | 52,Thailand,6.008,1.05,1.409,0.828,0.557,0.359,0.028 54 | 53,Latvia,5.94,1.187,1.465,0.812,0.264,0.075,0.064 55 | 54,South Korea,5.895,1.301,1.219,1.036,0.159,0.175,0.056 56 | 55,Estonia,5.893,1.237,1.528,0.874,0.495,0.103,0.161 57 | 56,Jamaica,5.89,0.831,1.478,0.831,0.49,0.107,0.028 58 | 57,Mauritius,5.888,1.12,1.402,0.798,0.498,0.215,0.06 59 | 58,Japan,5.886,1.327,1.419,1.088,0.445,0.069,0.14 60 | 59,Honduras,5.86,0.642,1.236,0.828,0.507,0.246,0.078 61 | 60,Kazakhstan,5.809,1.173,1.508,0.729,0.41,0.146,0.096 62 | 61,Bolivia,5.779,0.776,1.209,0.706,0.511,0.137,0.064 63 | 62,Hungary,5.758,1.201,1.41,0.828,0.199,0.081,0.02 64 | 63,Paraguay,5.743,0.855,1.475,0.777,0.514,0.184,0.08 65 | 64,Northern Cyprus,5.718,1.263,1.252,1.042,0.417,0.191,0.162 66 | 65,Peru,5.697,0.96,1.274,0.854,0.455,0.083,0.027 67 | 66,Portugal,5.693,1.221,1.431,0.999,0.508,0.047,0.025 68 | 67,Pakistan,5.653,0.677,0.886,0.535,0.313,0.22,0.098 69 | 68,Russia,5.648,1.183,1.452,0.726,0.334,0.082,0.031 70 | 69,Philippines,5.631,0.807,1.293,0.657,0.558,0.117,0.107 71 | 70,Serbia,5.603,1.004,1.383,0.854,0.282,0.137,0.039 72 | 71,Moldova,5.529,0.685,1.328,0.739,0.245,0.181,0.0 73 | 72,Libya,5.525,1.044,1.303,0.673,0.416,0.133,0.152 74 | 73,Montenegro,5.523,1.051,1.361,0.871,0.197,0.142,0.08 75 | 74,Tajikistan,5.467,0.493,1.098,0.718,0.389,0.23,0.144 76 | 75,Croatia,5.432,1.155,1.266,0.914,0.296,0.119,0.022 77 | 76,Hong Kong,5.43,1.438,1.277,1.122,0.44,0.258,0.287 78 | 77,Dominican Republic,5.425,1.015,1.401,0.779,0.497,0.113,0.101 79 | 78,Bosnia and Herzegovina,5.386,0.945,1.212,0.845,0.212,0.263,0.006 80 | 79,Turkey,5.373,1.183,1.36,0.808,0.195,0.083,0.106 81 | 80,Malaysia,5.339,1.221,1.171,0.828,0.508,0.26,0.024 82 | 81,Belarus,5.323,1.067,1.465,0.789,0.235,0.094,0.142 83 | 82,Greece,5.287,1.181,1.156,0.999,0.067,0.0,0.034 84 | 83,Mongolia,5.285,0.948,1.531,0.667,0.317,0.235,0.038 85 | 84,North Macedonia,5.274,0.983,1.294,0.838,0.345,0.185,0.034 86 | 85,Nigeria,5.265,0.696,1.111,0.245,0.426,0.215,0.041 87 | 86,Kyrgyzstan,5.261,0.551,1.438,0.723,0.508,0.3,0.023 88 | 87,Turkmenistan,5.247,1.052,1.538,0.657,0.394,0.244,0.028 89 | 88,Algeria,5.211,1.002,1.16,0.785,0.086,0.073,0.114 90 | 89,Morocco,5.208,0.801,0.782,0.782,0.418,0.036,0.076 91 | 90,Azerbaijan,5.208,1.043,1.147,0.769,0.351,0.035,0.182 92 | 91,Lebanon,5.197,0.987,1.224,0.815,0.216,0.166,0.027 93 | 92,Indonesia,5.192,0.931,1.203,0.66,0.491,0.498,0.028 94 | 93,China,5.191,1.029,1.125,0.893,0.521,0.058,0.1 95 | 94,Vietnam,5.175,0.741,1.346,0.851,0.543,0.147,0.073 96 | 95,Bhutan,5.082,0.813,1.321,0.604,0.457,0.37,0.167 97 | 96,Cameroon,5.044,0.549,0.91,0.331,0.381,0.187,0.037 98 | 97,Bulgaria,5.011,1.092,1.513,0.815,0.311,0.081,0.004 99 | 98,Ghana,4.996,0.611,0.868,0.486,0.381,0.245,0.04 100 | 99,Ivory Coast,4.944,0.569,0.808,0.232,0.352,0.154,0.09 101 | 100,Nepal,4.913,0.446,1.226,0.677,0.439,0.285,0.089 102 | 101,Jordan,4.906,0.837,1.225,0.815,0.383,0.11,0.13 103 | 102,Benin,4.883,0.393,0.437,0.397,0.349,0.175,0.082 104 | 103,Congo (Brazzaville),4.812,0.673,0.799,0.508,0.372,0.105,0.093 105 | 104,Gabon,4.799,1.057,1.183,0.571,0.295,0.043,0.055 106 | 105,Laos,4.796,0.764,1.03,0.551,0.547,0.266,0.164 107 | 106,South Africa,4.722,0.96,1.351,0.469,0.389,0.13,0.055 108 | 107,Albania,4.719,0.947,0.848,0.874,0.383,0.178,0.027 109 | 108,Venezuela,4.707,0.96,1.427,0.805,0.154,0.064,0.047 110 | 109,Cambodia,4.7,0.574,1.122,0.637,0.609,0.232,0.062 111 | 110,Palestinian Territories,4.696,0.657,1.247,0.672,0.225,0.103,0.066 112 | 111,Senegal,4.681,0.45,1.134,0.571,0.292,0.153,0.072 113 | 112,Somalia,4.668,0.0,0.698,0.268,0.559,0.243,0.27 114 | 113,Namibia,4.639,0.879,1.313,0.477,0.401,0.07,0.056 115 | 114,Niger,4.628,0.138,0.774,0.366,0.318,0.188,0.102 116 | 115,Burkina Faso,4.587,0.331,1.056,0.38,0.255,0.177,0.113 117 | 116,Armenia,4.559,0.85,1.055,0.815,0.283,0.095,0.064 118 | 117,Iran,4.548,1.1,0.842,0.785,0.305,0.27,0.125 119 | 118,Guinea,4.534,0.38,0.829,0.375,0.332,0.207,0.086 120 | 119,Georgia,4.519,0.886,0.666,0.752,0.346,0.043,0.164 121 | 120,Gambia,4.516,0.308,0.939,0.428,0.382,0.269,0.167 122 | 121,Kenya,4.509,0.512,0.983,0.581,0.431,0.372,0.053 123 | 122,Mauritania,4.49,0.57,1.167,0.489,0.066,0.106,0.088 124 | 123,Mozambique,4.466,0.204,0.986,0.39,0.494,0.197,0.138 125 | 124,Tunisia,4.461,0.921,1.0,0.815,0.167,0.059,0.055 126 | 125,Bangladesh,4.456,0.562,0.928,0.723,0.527,0.166,0.143 127 | 126,Iraq,4.437,1.043,0.98,0.574,0.241,0.148,0.089 128 | 127,Congo (Kinshasa),4.418,0.094,1.125,0.357,0.269,0.212,0.053 129 | 128,Mali,4.39,0.385,1.105,0.308,0.327,0.153,0.052 130 | 129,Sierra Leone,4.374,0.268,0.841,0.242,0.309,0.252,0.045 131 | 130,Sri Lanka,4.366,0.949,1.265,0.831,0.47,0.244,0.047 132 | 131,Myanmar,4.36,0.71,1.181,0.555,0.525,0.566,0.172 133 | 132,Chad,4.35,0.35,0.766,0.192,0.174,0.198,0.078 134 | 133,Ukraine,4.332,0.82,1.39,0.739,0.178,0.187,0.01 135 | 134,Ethiopia,4.286,0.336,1.033,0.532,0.344,0.209,0.1 136 | 135,Swaziland,4.212,0.811,1.149,0.0,0.313,0.074,0.135 137 | 136,Uganda,4.189,0.332,1.069,0.443,0.356,0.252,0.06 138 | 137,Egypt,4.166,0.913,1.039,0.644,0.241,0.076,0.067 139 | 138,Zambia,4.107,0.578,1.058,0.426,0.431,0.247,0.087 140 | 139,Togo,4.085,0.275,0.572,0.41,0.293,0.177,0.085 141 | 140,India,4.015,0.755,0.765,0.588,0.498,0.2,0.085 142 | 141,Liberia,3.975,0.073,0.922,0.443,0.37,0.233,0.033 143 | 142,Comoros,3.973,0.274,0.757,0.505,0.142,0.275,0.078 144 | 143,Madagascar,3.933,0.274,0.916,0.555,0.148,0.169,0.041 145 | 144,Lesotho,3.802,0.489,1.169,0.168,0.359,0.107,0.093 146 | 145,Burundi,3.775,0.046,0.447,0.38,0.22,0.176,0.18 147 | 146,Zimbabwe,3.663,0.366,1.114,0.433,0.361,0.151,0.089 148 | 147,Haiti,3.597,0.323,0.688,0.449,0.026,0.419,0.11 149 | 148,Botswana,3.488,1.041,1.145,0.538,0.455,0.025,0.1 150 | 149,Syria,3.462,0.619,0.378,0.44,0.013,0.331,0.141 151 | 150,Malawi,3.41,0.191,0.56,0.495,0.443,0.218,0.089 152 | 151,Yemen,3.38,0.287,1.163,0.463,0.143,0.108,0.077 153 | 152,Rwanda,3.334,0.359,0.711,0.614,0.555,0.217,0.411 154 | 153,Tanzania,3.231,0.476,0.885,0.499,0.417,0.276,0.147 155 | 154,Afghanistan,3.203,0.35,0.517,0.361,0.0,0.158,0.025 156 | 155,Central African Republic,3.083,0.026,0.0,0.105,0.225,0.235,0.035 157 | 156,South Sudan,2.853,0.306,0.575,0.295,0.01,0.202,0.091 158 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 AI Anytime 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LIDA-Demo-Streamlit-App 2 | Automatic Generation of Visualizations and Infographics with LLMs and Streamlit for your CSV data. 3 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | from lida import Manager, TextGenerationConfig , llm 3 | from dotenv import load_dotenv 4 | import os 5 | import openai 6 | from PIL import Image 7 | from io import BytesIO 8 | import base64 9 | 10 | load_dotenv() 11 | openai.api_key = os.getenv('OPENAI_API_KEY') 12 | 13 | def base64_to_image(base64_string): 14 | # Decode the base64 string 15 | byte_data = base64.b64decode(base64_string) 16 | 17 | # Use BytesIO to convert the byte data to image 18 | return Image.open(BytesIO(byte_data)) 19 | 20 | 21 | lida = Manager(text_gen = llm("openai")) 22 | textgen_config = TextGenerationConfig(n=1, temperature=0.5, model="gpt-3.5-turbo-0301", use_cache=True) 23 | 24 | menu = st.sidebar.selectbox("Choose an Option", ["Summarize", "Question based Graph"]) 25 | 26 | if menu == "Summarize": 27 | st.subheader("Summarization of your Data") 28 | file_uploader = st.file_uploader("Upload your CSV", type="csv") 29 | if file_uploader is not None: 30 | path_to_save = "filename.csv" 31 | with open(path_to_save, "wb") as f: 32 | f.write(file_uploader.getvalue()) 33 | summary = lida.summarize("filename.csv", summary_method="default", textgen_config=textgen_config) 34 | st.write(summary) 35 | goals = lida.goals(summary, n=2, textgen_config=textgen_config) 36 | for goal in goals: 37 | st.write(goal) 38 | i = 0 39 | library = "seaborn" 40 | textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True) 41 | charts = lida.visualize(summary=summary, goal=goals[i], textgen_config=textgen_config, library=library) 42 | img_base64_string = charts[0].raster 43 | img = base64_to_image(img_base64_string) 44 | st.image(img) 45 | 46 | 47 | 48 | 49 | elif menu == "Question based Graph": 50 | st.subheader("Query your Data to Generate Graph") 51 | file_uploader = st.file_uploader("Upload your CSV", type="csv") 52 | if file_uploader is not None: 53 | path_to_save = "filename1.csv" 54 | with open(path_to_save, "wb") as f: 55 | f.write(file_uploader.getvalue()) 56 | text_area = st.text_area("Query your Data to Generate Graph", height=200) 57 | if st.button("Generate Graph"): 58 | if len(text_area) > 0: 59 | st.info("Your Query: " + text_area) 60 | lida = Manager(text_gen = llm("openai")) 61 | textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True) 62 | summary = lida.summarize("filename1.csv", summary_method="default", textgen_config=textgen_config) 63 | user_query = text_area 64 | charts = lida.visualize(summary=summary, goal=user_query, textgen_config=textgen_config) 65 | charts[0] 66 | image_base64 = charts[0].raster 67 | img = base64_to_image(image_base64) 68 | st.image(img) 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /filename.csv: -------------------------------------------------------------------------------- 1 | Overall_rank,Country_or_region,Score,GDP_per_capita,Social_support,Healthy_life_expectancy,Freedom_to_make_life_choices,Generosity,Perceptions_of_corruption 2 | 1,Finland,7.769,1.34,1.587,0.986,0.596,0.153,0.393 3 | 2,Denmark,7.6,1.383,1.573,0.996,0.592,0.252,0.41 4 | 3,Norway,7.554,1.488,1.582,1.028,0.603,0.271,0.341 5 | 4,Iceland,7.494,1.38,1.624,1.026,0.591,0.354,0.118 6 | 5,Netherlands,7.488,1.396,1.522,0.999,0.557,0.322,0.298 7 | 6,Switzerland,7.48,1.452,1.526,1.052,0.572,0.263,0.343 8 | 7,Sweden,7.343,1.387,1.487,1.009,0.574,0.267,0.373 9 | 8,New Zealand,7.307,1.303,1.557,1.026,0.585,0.33,0.38 10 | 9,Canada,7.278,1.365,1.505,1.039,0.584,0.285,0.308 11 | 10,Austria,7.246,1.376,1.475,1.016,0.532,0.244,0.226 12 | 11,Australia,7.228,1.372,1.548,1.036,0.557,0.332,0.29 13 | 12,Costa Rica,7.167,1.034,1.441,0.963,0.558,0.144,0.093 14 | 13,Israel,7.139,1.276,1.455,1.029,0.371,0.261,0.082 15 | 14,Luxembourg,7.09,1.609,1.479,1.012,0.526,0.194,0.316 16 | 15,United Kingdom,7.054,1.333,1.538,0.996,0.45,0.348,0.278 17 | 16,Ireland,7.021,1.499,1.553,0.999,0.516,0.298,0.31 18 | 17,Germany,6.985,1.373,1.454,0.987,0.495,0.261,0.265 19 | 18,Belgium,6.923,1.356,1.504,0.986,0.473,0.16,0.21 20 | 19,United States,6.892,1.433,1.457,0.874,0.454,0.28,0.128 21 | 20,Czech Republic,6.852,1.269,1.487,0.92,0.457,0.046,0.036 22 | 21,United Arab Emirates,6.825,1.503,1.31,0.825,0.598,0.262,0.182 23 | 22,Malta,6.726,1.3,1.52,0.999,0.564,0.375,0.151 24 | 23,Mexico,6.595,1.07,1.323,0.861,0.433,0.074,0.073 25 | 24,France,6.592,1.324,1.472,1.045,0.436,0.111,0.183 26 | 25,Taiwan,6.446,1.368,1.43,0.914,0.351,0.242,0.097 27 | 26,Chile,6.444,1.159,1.369,0.92,0.357,0.187,0.056 28 | 27,Guatemala,6.436,0.8,1.269,0.746,0.535,0.175,0.078 29 | 28,Saudi Arabia,6.375,1.403,1.357,0.795,0.439,0.08,0.132 30 | 29,Qatar,6.374,1.684,1.313,0.871,0.555,0.22,0.167 31 | 30,Spain,6.354,1.286,1.484,1.062,0.362,0.153,0.079 32 | 31,Panama,6.321,1.149,1.442,0.91,0.516,0.109,0.054 33 | 32,Brazil,6.3,1.004,1.439,0.802,0.39,0.099,0.086 34 | 33,Uruguay,6.293,1.124,1.465,0.891,0.523,0.127,0.15 35 | 34,Singapore,6.262,1.572,1.463,1.141,0.556,0.271,0.453 36 | 35,El Salvador,6.253,0.794,1.242,0.789,0.43,0.093,0.074 37 | 36,Italy,6.223,1.294,1.488,1.039,0.231,0.158,0.03 38 | 37,Bahrain,6.199,1.362,1.368,0.871,0.536,0.255,0.11 39 | 38,Slovakia,6.198,1.246,1.504,0.881,0.334,0.121,0.014 40 | 39,Trinidad & Tobago,6.192,1.231,1.477,0.713,0.489,0.185,0.016 41 | 40,Poland,6.182,1.206,1.438,0.884,0.483,0.117,0.05 42 | 41,Uzbekistan,6.174,0.745,1.529,0.756,0.631,0.322,0.24 43 | 42,Lithuania,6.149,1.238,1.515,0.818,0.291,0.043,0.042 44 | 43,Colombia,6.125,0.985,1.41,0.841,0.47,0.099,0.034 45 | 44,Slovenia,6.118,1.258,1.523,0.953,0.564,0.144,0.057 46 | 45,Nicaragua,6.105,0.694,1.325,0.835,0.435,0.2,0.127 47 | 46,Kosovo,6.1,0.882,1.232,0.758,0.489,0.262,0.006 48 | 47,Argentina,6.086,1.092,1.432,0.881,0.471,0.066,0.05 49 | 48,Romania,6.07,1.162,1.232,0.825,0.462,0.083,0.005 50 | 49,Cyprus,6.046,1.263,1.223,1.042,0.406,0.19,0.041 51 | 50,Ecuador,6.028,0.912,1.312,0.868,0.498,0.126,0.087 52 | 51,Kuwait,6.021,1.5,1.319,0.808,0.493,0.142,0.097 53 | 52,Thailand,6.008,1.05,1.409,0.828,0.557,0.359,0.028 54 | 53,Latvia,5.94,1.187,1.465,0.812,0.264,0.075,0.064 55 | 54,South Korea,5.895,1.301,1.219,1.036,0.159,0.175,0.056 56 | 55,Estonia,5.893,1.237,1.528,0.874,0.495,0.103,0.161 57 | 56,Jamaica,5.89,0.831,1.478,0.831,0.49,0.107,0.028 58 | 57,Mauritius,5.888,1.12,1.402,0.798,0.498,0.215,0.06 59 | 58,Japan,5.886,1.327,1.419,1.088,0.445,0.069,0.14 60 | 59,Honduras,5.86,0.642,1.236,0.828,0.507,0.246,0.078 61 | 60,Kazakhstan,5.809,1.173,1.508,0.729,0.41,0.146,0.096 62 | 61,Bolivia,5.779,0.776,1.209,0.706,0.511,0.137,0.064 63 | 62,Hungary,5.758,1.201,1.41,0.828,0.199,0.081,0.02 64 | 63,Paraguay,5.743,0.855,1.475,0.777,0.514,0.184,0.08 65 | 64,Northern Cyprus,5.718,1.263,1.252,1.042,0.417,0.191,0.162 66 | 65,Peru,5.697,0.96,1.274,0.854,0.455,0.083,0.027 67 | 66,Portugal,5.693,1.221,1.431,0.999,0.508,0.047,0.025 68 | 67,Pakistan,5.653,0.677,0.886,0.535,0.313,0.22,0.098 69 | 68,Russia,5.648,1.183,1.452,0.726,0.334,0.082,0.031 70 | 69,Philippines,5.631,0.807,1.293,0.657,0.558,0.117,0.107 71 | 70,Serbia,5.603,1.004,1.383,0.854,0.282,0.137,0.039 72 | 71,Moldova,5.529,0.685,1.328,0.739,0.245,0.181,0.0 73 | 72,Libya,5.525,1.044,1.303,0.673,0.416,0.133,0.152 74 | 73,Montenegro,5.523,1.051,1.361,0.871,0.197,0.142,0.08 75 | 74,Tajikistan,5.467,0.493,1.098,0.718,0.389,0.23,0.144 76 | 75,Croatia,5.432,1.155,1.266,0.914,0.296,0.119,0.022 77 | 76,Hong Kong,5.43,1.438,1.277,1.122,0.44,0.258,0.287 78 | 77,Dominican Republic,5.425,1.015,1.401,0.779,0.497,0.113,0.101 79 | 78,Bosnia and Herzegovina,5.386,0.945,1.212,0.845,0.212,0.263,0.006 80 | 79,Turkey,5.373,1.183,1.36,0.808,0.195,0.083,0.106 81 | 80,Malaysia,5.339,1.221,1.171,0.828,0.508,0.26,0.024 82 | 81,Belarus,5.323,1.067,1.465,0.789,0.235,0.094,0.142 83 | 82,Greece,5.287,1.181,1.156,0.999,0.067,0.0,0.034 84 | 83,Mongolia,5.285,0.948,1.531,0.667,0.317,0.235,0.038 85 | 84,North Macedonia,5.274,0.983,1.294,0.838,0.345,0.185,0.034 86 | 85,Nigeria,5.265,0.696,1.111,0.245,0.426,0.215,0.041 87 | 86,Kyrgyzstan,5.261,0.551,1.438,0.723,0.508,0.3,0.023 88 | 87,Turkmenistan,5.247,1.052,1.538,0.657,0.394,0.244,0.028 89 | 88,Algeria,5.211,1.002,1.16,0.785,0.086,0.073,0.114 90 | 89,Morocco,5.208,0.801,0.782,0.782,0.418,0.036,0.076 91 | 90,Azerbaijan,5.208,1.043,1.147,0.769,0.351,0.035,0.182 92 | 91,Lebanon,5.197,0.987,1.224,0.815,0.216,0.166,0.027 93 | 92,Indonesia,5.192,0.931,1.203,0.66,0.491,0.498,0.028 94 | 93,China,5.191,1.029,1.125,0.893,0.521,0.058,0.1 95 | 94,Vietnam,5.175,0.741,1.346,0.851,0.543,0.147,0.073 96 | 95,Bhutan,5.082,0.813,1.321,0.604,0.457,0.37,0.167 97 | 96,Cameroon,5.044,0.549,0.91,0.331,0.381,0.187,0.037 98 | 97,Bulgaria,5.011,1.092,1.513,0.815,0.311,0.081,0.004 99 | 98,Ghana,4.996,0.611,0.868,0.486,0.381,0.245,0.04 100 | 99,Ivory Coast,4.944,0.569,0.808,0.232,0.352,0.154,0.09 101 | 100,Nepal,4.913,0.446,1.226,0.677,0.439,0.285,0.089 102 | 101,Jordan,4.906,0.837,1.225,0.815,0.383,0.11,0.13 103 | 102,Benin,4.883,0.393,0.437,0.397,0.349,0.175,0.082 104 | 103,Congo (Brazzaville),4.812,0.673,0.799,0.508,0.372,0.105,0.093 105 | 104,Gabon,4.799,1.057,1.183,0.571,0.295,0.043,0.055 106 | 105,Laos,4.796,0.764,1.03,0.551,0.547,0.266,0.164 107 | 106,South Africa,4.722,0.96,1.351,0.469,0.389,0.13,0.055 108 | 107,Albania,4.719,0.947,0.848,0.874,0.383,0.178,0.027 109 | 108,Venezuela,4.707,0.96,1.427,0.805,0.154,0.064,0.047 110 | 109,Cambodia,4.7,0.574,1.122,0.637,0.609,0.232,0.062 111 | 110,Palestinian Territories,4.696,0.657,1.247,0.672,0.225,0.103,0.066 112 | 111,Senegal,4.681,0.45,1.134,0.571,0.292,0.153,0.072 113 | 112,Somalia,4.668,0.0,0.698,0.268,0.559,0.243,0.27 114 | 113,Namibia,4.639,0.879,1.313,0.477,0.401,0.07,0.056 115 | 114,Niger,4.628,0.138,0.774,0.366,0.318,0.188,0.102 116 | 115,Burkina Faso,4.587,0.331,1.056,0.38,0.255,0.177,0.113 117 | 116,Armenia,4.559,0.85,1.055,0.815,0.283,0.095,0.064 118 | 117,Iran,4.548,1.1,0.842,0.785,0.305,0.27,0.125 119 | 118,Guinea,4.534,0.38,0.829,0.375,0.332,0.207,0.086 120 | 119,Georgia,4.519,0.886,0.666,0.752,0.346,0.043,0.164 121 | 120,Gambia,4.516,0.308,0.939,0.428,0.382,0.269,0.167 122 | 121,Kenya,4.509,0.512,0.983,0.581,0.431,0.372,0.053 123 | 122,Mauritania,4.49,0.57,1.167,0.489,0.066,0.106,0.088 124 | 123,Mozambique,4.466,0.204,0.986,0.39,0.494,0.197,0.138 125 | 124,Tunisia,4.461,0.921,1.0,0.815,0.167,0.059,0.055 126 | 125,Bangladesh,4.456,0.562,0.928,0.723,0.527,0.166,0.143 127 | 126,Iraq,4.437,1.043,0.98,0.574,0.241,0.148,0.089 128 | 127,Congo (Kinshasa),4.418,0.094,1.125,0.357,0.269,0.212,0.053 129 | 128,Mali,4.39,0.385,1.105,0.308,0.327,0.153,0.052 130 | 129,Sierra Leone,4.374,0.268,0.841,0.242,0.309,0.252,0.045 131 | 130,Sri Lanka,4.366,0.949,1.265,0.831,0.47,0.244,0.047 132 | 131,Myanmar,4.36,0.71,1.181,0.555,0.525,0.566,0.172 133 | 132,Chad,4.35,0.35,0.766,0.192,0.174,0.198,0.078 134 | 133,Ukraine,4.332,0.82,1.39,0.739,0.178,0.187,0.01 135 | 134,Ethiopia,4.286,0.336,1.033,0.532,0.344,0.209,0.1 136 | 135,Swaziland,4.212,0.811,1.149,0.0,0.313,0.074,0.135 137 | 136,Uganda,4.189,0.332,1.069,0.443,0.356,0.252,0.06 138 | 137,Egypt,4.166,0.913,1.039,0.644,0.241,0.076,0.067 139 | 138,Zambia,4.107,0.578,1.058,0.426,0.431,0.247,0.087 140 | 139,Togo,4.085,0.275,0.572,0.41,0.293,0.177,0.085 141 | 140,India,4.015,0.755,0.765,0.588,0.498,0.2,0.085 142 | 141,Liberia,3.975,0.073,0.922,0.443,0.37,0.233,0.033 143 | 142,Comoros,3.973,0.274,0.757,0.505,0.142,0.275,0.078 144 | 143,Madagascar,3.933,0.274,0.916,0.555,0.148,0.169,0.041 145 | 144,Lesotho,3.802,0.489,1.169,0.168,0.359,0.107,0.093 146 | 145,Burundi,3.775,0.046,0.447,0.38,0.22,0.176,0.18 147 | 146,Zimbabwe,3.663,0.366,1.114,0.433,0.361,0.151,0.089 148 | 147,Haiti,3.597,0.323,0.688,0.449,0.026,0.419,0.11 149 | 148,Botswana,3.488,1.041,1.145,0.538,0.455,0.025,0.1 150 | 149,Syria,3.462,0.619,0.378,0.44,0.013,0.331,0.141 151 | 150,Malawi,3.41,0.191,0.56,0.495,0.443,0.218,0.089 152 | 151,Yemen,3.38,0.287,1.163,0.463,0.143,0.108,0.077 153 | 152,Rwanda,3.334,0.359,0.711,0.614,0.555,0.217,0.411 154 | 153,Tanzania,3.231,0.476,0.885,0.499,0.417,0.276,0.147 155 | 154,Afghanistan,3.203,0.35,0.517,0.361,0.0,0.158,0.025 156 | 155,Central African Republic,3.083,0.026,0.0,0.105,0.225,0.235,0.035 157 | 156,South Sudan,2.853,0.306,0.575,0.295,0.01,0.202,0.091 158 | -------------------------------------------------------------------------------- /filename.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AIAnytime/LIDA-Demo-Streamlit-App/13fd3d9a448fd1cdaaf4ae9153565babb726f9b8/filename.png -------------------------------------------------------------------------------- /filename1.csv: -------------------------------------------------------------------------------- 1 | Overall_rank,Country_or_region,Score,GDP_per_capita,Social_support,Healthy_life_expectancy,Freedom_to_make_life_choices,Generosity,Perceptions_of_corruption 2 | 1,Finland,7.769,1.34,1.587,0.986,0.596,0.153,0.393 3 | 2,Denmark,7.6,1.383,1.573,0.996,0.592,0.252,0.41 4 | 3,Norway,7.554,1.488,1.582,1.028,0.603,0.271,0.341 5 | 4,Iceland,7.494,1.38,1.624,1.026,0.591,0.354,0.118 6 | 5,Netherlands,7.488,1.396,1.522,0.999,0.557,0.322,0.298 7 | 6,Switzerland,7.48,1.452,1.526,1.052,0.572,0.263,0.343 8 | 7,Sweden,7.343,1.387,1.487,1.009,0.574,0.267,0.373 9 | 8,New Zealand,7.307,1.303,1.557,1.026,0.585,0.33,0.38 10 | 9,Canada,7.278,1.365,1.505,1.039,0.584,0.285,0.308 11 | 10,Austria,7.246,1.376,1.475,1.016,0.532,0.244,0.226 12 | 11,Australia,7.228,1.372,1.548,1.036,0.557,0.332,0.29 13 | 12,Costa Rica,7.167,1.034,1.441,0.963,0.558,0.144,0.093 14 | 13,Israel,7.139,1.276,1.455,1.029,0.371,0.261,0.082 15 | 14,Luxembourg,7.09,1.609,1.479,1.012,0.526,0.194,0.316 16 | 15,United Kingdom,7.054,1.333,1.538,0.996,0.45,0.348,0.278 17 | 16,Ireland,7.021,1.499,1.553,0.999,0.516,0.298,0.31 18 | 17,Germany,6.985,1.373,1.454,0.987,0.495,0.261,0.265 19 | 18,Belgium,6.923,1.356,1.504,0.986,0.473,0.16,0.21 20 | 19,United States,6.892,1.433,1.457,0.874,0.454,0.28,0.128 21 | 20,Czech Republic,6.852,1.269,1.487,0.92,0.457,0.046,0.036 22 | 21,United Arab Emirates,6.825,1.503,1.31,0.825,0.598,0.262,0.182 23 | 22,Malta,6.726,1.3,1.52,0.999,0.564,0.375,0.151 24 | 23,Mexico,6.595,1.07,1.323,0.861,0.433,0.074,0.073 25 | 24,France,6.592,1.324,1.472,1.045,0.436,0.111,0.183 26 | 25,Taiwan,6.446,1.368,1.43,0.914,0.351,0.242,0.097 27 | 26,Chile,6.444,1.159,1.369,0.92,0.357,0.187,0.056 28 | 27,Guatemala,6.436,0.8,1.269,0.746,0.535,0.175,0.078 29 | 28,Saudi Arabia,6.375,1.403,1.357,0.795,0.439,0.08,0.132 30 | 29,Qatar,6.374,1.684,1.313,0.871,0.555,0.22,0.167 31 | 30,Spain,6.354,1.286,1.484,1.062,0.362,0.153,0.079 32 | 31,Panama,6.321,1.149,1.442,0.91,0.516,0.109,0.054 33 | 32,Brazil,6.3,1.004,1.439,0.802,0.39,0.099,0.086 34 | 33,Uruguay,6.293,1.124,1.465,0.891,0.523,0.127,0.15 35 | 34,Singapore,6.262,1.572,1.463,1.141,0.556,0.271,0.453 36 | 35,El Salvador,6.253,0.794,1.242,0.789,0.43,0.093,0.074 37 | 36,Italy,6.223,1.294,1.488,1.039,0.231,0.158,0.03 38 | 37,Bahrain,6.199,1.362,1.368,0.871,0.536,0.255,0.11 39 | 38,Slovakia,6.198,1.246,1.504,0.881,0.334,0.121,0.014 40 | 39,Trinidad & Tobago,6.192,1.231,1.477,0.713,0.489,0.185,0.016 41 | 40,Poland,6.182,1.206,1.438,0.884,0.483,0.117,0.05 42 | 41,Uzbekistan,6.174,0.745,1.529,0.756,0.631,0.322,0.24 43 | 42,Lithuania,6.149,1.238,1.515,0.818,0.291,0.043,0.042 44 | 43,Colombia,6.125,0.985,1.41,0.841,0.47,0.099,0.034 45 | 44,Slovenia,6.118,1.258,1.523,0.953,0.564,0.144,0.057 46 | 45,Nicaragua,6.105,0.694,1.325,0.835,0.435,0.2,0.127 47 | 46,Kosovo,6.1,0.882,1.232,0.758,0.489,0.262,0.006 48 | 47,Argentina,6.086,1.092,1.432,0.881,0.471,0.066,0.05 49 | 48,Romania,6.07,1.162,1.232,0.825,0.462,0.083,0.005 50 | 49,Cyprus,6.046,1.263,1.223,1.042,0.406,0.19,0.041 51 | 50,Ecuador,6.028,0.912,1.312,0.868,0.498,0.126,0.087 52 | 51,Kuwait,6.021,1.5,1.319,0.808,0.493,0.142,0.097 53 | 52,Thailand,6.008,1.05,1.409,0.828,0.557,0.359,0.028 54 | 53,Latvia,5.94,1.187,1.465,0.812,0.264,0.075,0.064 55 | 54,South Korea,5.895,1.301,1.219,1.036,0.159,0.175,0.056 56 | 55,Estonia,5.893,1.237,1.528,0.874,0.495,0.103,0.161 57 | 56,Jamaica,5.89,0.831,1.478,0.831,0.49,0.107,0.028 58 | 57,Mauritius,5.888,1.12,1.402,0.798,0.498,0.215,0.06 59 | 58,Japan,5.886,1.327,1.419,1.088,0.445,0.069,0.14 60 | 59,Honduras,5.86,0.642,1.236,0.828,0.507,0.246,0.078 61 | 60,Kazakhstan,5.809,1.173,1.508,0.729,0.41,0.146,0.096 62 | 61,Bolivia,5.779,0.776,1.209,0.706,0.511,0.137,0.064 63 | 62,Hungary,5.758,1.201,1.41,0.828,0.199,0.081,0.02 64 | 63,Paraguay,5.743,0.855,1.475,0.777,0.514,0.184,0.08 65 | 64,Northern Cyprus,5.718,1.263,1.252,1.042,0.417,0.191,0.162 66 | 65,Peru,5.697,0.96,1.274,0.854,0.455,0.083,0.027 67 | 66,Portugal,5.693,1.221,1.431,0.999,0.508,0.047,0.025 68 | 67,Pakistan,5.653,0.677,0.886,0.535,0.313,0.22,0.098 69 | 68,Russia,5.648,1.183,1.452,0.726,0.334,0.082,0.031 70 | 69,Philippines,5.631,0.807,1.293,0.657,0.558,0.117,0.107 71 | 70,Serbia,5.603,1.004,1.383,0.854,0.282,0.137,0.039 72 | 71,Moldova,5.529,0.685,1.328,0.739,0.245,0.181,0.0 73 | 72,Libya,5.525,1.044,1.303,0.673,0.416,0.133,0.152 74 | 73,Montenegro,5.523,1.051,1.361,0.871,0.197,0.142,0.08 75 | 74,Tajikistan,5.467,0.493,1.098,0.718,0.389,0.23,0.144 76 | 75,Croatia,5.432,1.155,1.266,0.914,0.296,0.119,0.022 77 | 76,Hong Kong,5.43,1.438,1.277,1.122,0.44,0.258,0.287 78 | 77,Dominican Republic,5.425,1.015,1.401,0.779,0.497,0.113,0.101 79 | 78,Bosnia and Herzegovina,5.386,0.945,1.212,0.845,0.212,0.263,0.006 80 | 79,Turkey,5.373,1.183,1.36,0.808,0.195,0.083,0.106 81 | 80,Malaysia,5.339,1.221,1.171,0.828,0.508,0.26,0.024 82 | 81,Belarus,5.323,1.067,1.465,0.789,0.235,0.094,0.142 83 | 82,Greece,5.287,1.181,1.156,0.999,0.067,0.0,0.034 84 | 83,Mongolia,5.285,0.948,1.531,0.667,0.317,0.235,0.038 85 | 84,North Macedonia,5.274,0.983,1.294,0.838,0.345,0.185,0.034 86 | 85,Nigeria,5.265,0.696,1.111,0.245,0.426,0.215,0.041 87 | 86,Kyrgyzstan,5.261,0.551,1.438,0.723,0.508,0.3,0.023 88 | 87,Turkmenistan,5.247,1.052,1.538,0.657,0.394,0.244,0.028 89 | 88,Algeria,5.211,1.002,1.16,0.785,0.086,0.073,0.114 90 | 89,Morocco,5.208,0.801,0.782,0.782,0.418,0.036,0.076 91 | 90,Azerbaijan,5.208,1.043,1.147,0.769,0.351,0.035,0.182 92 | 91,Lebanon,5.197,0.987,1.224,0.815,0.216,0.166,0.027 93 | 92,Indonesia,5.192,0.931,1.203,0.66,0.491,0.498,0.028 94 | 93,China,5.191,1.029,1.125,0.893,0.521,0.058,0.1 95 | 94,Vietnam,5.175,0.741,1.346,0.851,0.543,0.147,0.073 96 | 95,Bhutan,5.082,0.813,1.321,0.604,0.457,0.37,0.167 97 | 96,Cameroon,5.044,0.549,0.91,0.331,0.381,0.187,0.037 98 | 97,Bulgaria,5.011,1.092,1.513,0.815,0.311,0.081,0.004 99 | 98,Ghana,4.996,0.611,0.868,0.486,0.381,0.245,0.04 100 | 99,Ivory Coast,4.944,0.569,0.808,0.232,0.352,0.154,0.09 101 | 100,Nepal,4.913,0.446,1.226,0.677,0.439,0.285,0.089 102 | 101,Jordan,4.906,0.837,1.225,0.815,0.383,0.11,0.13 103 | 102,Benin,4.883,0.393,0.437,0.397,0.349,0.175,0.082 104 | 103,Congo (Brazzaville),4.812,0.673,0.799,0.508,0.372,0.105,0.093 105 | 104,Gabon,4.799,1.057,1.183,0.571,0.295,0.043,0.055 106 | 105,Laos,4.796,0.764,1.03,0.551,0.547,0.266,0.164 107 | 106,South Africa,4.722,0.96,1.351,0.469,0.389,0.13,0.055 108 | 107,Albania,4.719,0.947,0.848,0.874,0.383,0.178,0.027 109 | 108,Venezuela,4.707,0.96,1.427,0.805,0.154,0.064,0.047 110 | 109,Cambodia,4.7,0.574,1.122,0.637,0.609,0.232,0.062 111 | 110,Palestinian Territories,4.696,0.657,1.247,0.672,0.225,0.103,0.066 112 | 111,Senegal,4.681,0.45,1.134,0.571,0.292,0.153,0.072 113 | 112,Somalia,4.668,0.0,0.698,0.268,0.559,0.243,0.27 114 | 113,Namibia,4.639,0.879,1.313,0.477,0.401,0.07,0.056 115 | 114,Niger,4.628,0.138,0.774,0.366,0.318,0.188,0.102 116 | 115,Burkina Faso,4.587,0.331,1.056,0.38,0.255,0.177,0.113 117 | 116,Armenia,4.559,0.85,1.055,0.815,0.283,0.095,0.064 118 | 117,Iran,4.548,1.1,0.842,0.785,0.305,0.27,0.125 119 | 118,Guinea,4.534,0.38,0.829,0.375,0.332,0.207,0.086 120 | 119,Georgia,4.519,0.886,0.666,0.752,0.346,0.043,0.164 121 | 120,Gambia,4.516,0.308,0.939,0.428,0.382,0.269,0.167 122 | 121,Kenya,4.509,0.512,0.983,0.581,0.431,0.372,0.053 123 | 122,Mauritania,4.49,0.57,1.167,0.489,0.066,0.106,0.088 124 | 123,Mozambique,4.466,0.204,0.986,0.39,0.494,0.197,0.138 125 | 124,Tunisia,4.461,0.921,1.0,0.815,0.167,0.059,0.055 126 | 125,Bangladesh,4.456,0.562,0.928,0.723,0.527,0.166,0.143 127 | 126,Iraq,4.437,1.043,0.98,0.574,0.241,0.148,0.089 128 | 127,Congo (Kinshasa),4.418,0.094,1.125,0.357,0.269,0.212,0.053 129 | 128,Mali,4.39,0.385,1.105,0.308,0.327,0.153,0.052 130 | 129,Sierra Leone,4.374,0.268,0.841,0.242,0.309,0.252,0.045 131 | 130,Sri Lanka,4.366,0.949,1.265,0.831,0.47,0.244,0.047 132 | 131,Myanmar,4.36,0.71,1.181,0.555,0.525,0.566,0.172 133 | 132,Chad,4.35,0.35,0.766,0.192,0.174,0.198,0.078 134 | 133,Ukraine,4.332,0.82,1.39,0.739,0.178,0.187,0.01 135 | 134,Ethiopia,4.286,0.336,1.033,0.532,0.344,0.209,0.1 136 | 135,Swaziland,4.212,0.811,1.149,0.0,0.313,0.074,0.135 137 | 136,Uganda,4.189,0.332,1.069,0.443,0.356,0.252,0.06 138 | 137,Egypt,4.166,0.913,1.039,0.644,0.241,0.076,0.067 139 | 138,Zambia,4.107,0.578,1.058,0.426,0.431,0.247,0.087 140 | 139,Togo,4.085,0.275,0.572,0.41,0.293,0.177,0.085 141 | 140,India,4.015,0.755,0.765,0.588,0.498,0.2,0.085 142 | 141,Liberia,3.975,0.073,0.922,0.443,0.37,0.233,0.033 143 | 142,Comoros,3.973,0.274,0.757,0.505,0.142,0.275,0.078 144 | 143,Madagascar,3.933,0.274,0.916,0.555,0.148,0.169,0.041 145 | 144,Lesotho,3.802,0.489,1.169,0.168,0.359,0.107,0.093 146 | 145,Burundi,3.775,0.046,0.447,0.38,0.22,0.176,0.18 147 | 146,Zimbabwe,3.663,0.366,1.114,0.433,0.361,0.151,0.089 148 | 147,Haiti,3.597,0.323,0.688,0.449,0.026,0.419,0.11 149 | 148,Botswana,3.488,1.041,1.145,0.538,0.455,0.025,0.1 150 | 149,Syria,3.462,0.619,0.378,0.44,0.013,0.331,0.141 151 | 150,Malawi,3.41,0.191,0.56,0.495,0.443,0.218,0.089 152 | 151,Yemen,3.38,0.287,1.163,0.463,0.143,0.108,0.077 153 | 152,Rwanda,3.334,0.359,0.711,0.614,0.555,0.217,0.411 154 | 153,Tanzania,3.231,0.476,0.885,0.499,0.417,0.276,0.147 155 | 154,Afghanistan,3.203,0.35,0.517,0.361,0.0,0.158,0.025 156 | 155,Central African Republic,3.083,0.026,0.0,0.105,0.225,0.235,0.035 157 | 156,South Sudan,2.853,0.306,0.575,0.295,0.01,0.202,0.091 158 | -------------------------------------------------------------------------------- /filename1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AIAnytime/LIDA-Demo-Streamlit-App/13fd3d9a448fd1cdaaf4ae9153565babb726f9b8/filename1.png -------------------------------------------------------------------------------- /query.py: -------------------------------------------------------------------------------- 1 | from lida import Manager, TextGenerationConfig , llm 2 | from dotenv import load_dotenv 3 | import os 4 | import openai 5 | import base64 6 | from PIL import Image 7 | from io import BytesIO 8 | 9 | load_dotenv() 10 | 11 | openai.api_key = os.getenv('OPENAI_API_KEY') 12 | 13 | def base64_to_image(base64_string): 14 | # Decode the base64 string 15 | byte_data = base64.b64decode(base64_string) 16 | 17 | # Use BytesIO to convert the byte data to image 18 | return Image.open(BytesIO(byte_data)) 19 | 20 | def save_image(base64_str, save_path): 21 | img = base64_to_image(base64_str) 22 | img.save(save_path) 23 | print(f"Image saved at {save_path}") 24 | 25 | lida = Manager(text_gen = llm("openai")) 26 | textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True) 27 | summary = lida.summarize("2019.csv", summary_method="default", textgen_config=textgen_config) 28 | 29 | user_query = "Which country has the most GDP per capita?" 30 | charts = lida.visualize(summary=summary, goal=user_query, textgen_config=textgen_config) 31 | charts[0] 32 | 33 | image_base64 = charts[0].raster 34 | 35 | save_image(image_base64, "filename1.png") 36 | 37 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | lida 2 | lida[transformers] 3 | torch 4 | streamlit -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | from lida import Manager, TextGenerationConfig , llm 2 | from dotenv import load_dotenv 3 | import os 4 | import openai 5 | import base64 6 | from PIL import Image 7 | from io import BytesIO 8 | 9 | print("Import Successful!") 10 | 11 | load_dotenv() 12 | 13 | def base64_to_image(base64_string): 14 | # Decode the base64 string 15 | byte_data = base64.b64decode(base64_string) 16 | 17 | # Use BytesIO to convert the byte data to image 18 | return Image.open(BytesIO(byte_data)) 19 | 20 | def save_image(base64_str, save_path): 21 | img = base64_to_image(base64_str) 22 | img.save(save_path) 23 | print(f"Image saved at {save_path}") 24 | 25 | openai.api_key = os.getenv('OPENAI_API_KEY') 26 | 27 | #text_gen = llm("openai") 28 | #text_gen = llm(provider="hf", model="togethercomputer/Llama-2-7B-32K-Instruct", device_map="cpu") 29 | 30 | lida = Manager(text_gen = llm("openai")) 31 | 32 | print("Model Loaded Successfully!") 33 | 34 | textgen_config = TextGenerationConfig(n=1, temperature=0.5, model="gpt-3.5-turbo-0301", use_cache=True) 35 | 36 | summary = lida.summarize("2019.csv", summary_method="default", textgen_config=textgen_config) 37 | 38 | print(summary) 39 | 40 | goals = lida.goals(summary, n=2, textgen_config=textgen_config) 41 | 42 | for goal in goals: 43 | print(goal) 44 | 45 | i = 0 46 | library = "seaborn" 47 | textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True) 48 | charts = lida.visualize(summary=summary, goal=goals[i], textgen_config=textgen_config, library=library) 49 | image_base64 = charts[0].raster 50 | 51 | 52 | save_image(image_base64, "filename.png") 53 | --------------------------------------------------------------------------------