-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamlit_app.py
230 lines (175 loc) · 5.9 KB
/
streamlit_app.py
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# -*- coding: utf-8 -*-
# Copyright 2018-2022 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""An example of showing geographic data."""
import os
import altair as alt
import numpy as np
import pandas as pd
import pydeck as pdk
import streamlit as st
# SETTING PAGE CONFIG TO WIDE MODE AND ADDING A TITLE AND FAVICON
st.set_page_config(page_title="AI Infrastructure Statistics", page_icon=":taxi:")
# LOAD DATA ONCE
@st.cache_data
def load_data(path):
if not os.path.isfile(path):
path = f"https://github.com/tensorchord/ai-infra-statistics/raw/main/{path}"
data = pd.read_csv(
path,
nrows=100000, # approx. 10% of data
names=[
"date",
"downloads",
"project",
], # specify names directly since they don't change
skiprows=1, # don't read header since names specified directly
usecols=[0, 1, 2], # doesn't load last column, constant value "B02512"
parse_dates=[
"date"
], # set as datetime instead of converting after the fact
)
return data
@st.cache_data
def load_data_d(path):
if not os.path.isfile(path):
path = f"https://github.com/tensorchord/ai-infra-statistics/raw/main/{path}"
data = pd.read_csv(
path,
nrows=100000, # approx. 10% of data
names=[
"date",
"downloads",
"project",
], # specify names directly since they don't change
skiprows=1, # don't read header since names specified directly
usecols=[0, 1, 2], # doesn't load last column, constant value "B02512"
parse_dates=[
"date"
], # set as datetime instead of converting after the fact
)
# every row minus the first row
for i in range(7, len(data)):
print(i, i % 6)
print(data["project"][i])
print(data["project"][i % 6])
print(data["downloads"][i])
print(data["downloads"][i % 6])
data["downloads"][i] = data["downloads"][i] - data["downloads"][i % 6]
# Remove the first 6 rows
data["downloads"][0] = 0
data["downloads"][1] = 0
data["downloads"][2] = 0
data["downloads"][3] = 0
data["downloads"][4] = 0
data["downloads"][5] = 0
data["downloads"][6] = 0
return data
# STREAMLIT APP LAYOUT
st.title("AI Infrastructure Statistics")
st.markdown(
"""
This app shows the statistics of AI infrastructure projects. You could find the source code of this app here: [tensorchord/ai-infra-statistics](https://github.com/tensorchord/ai-infra-statistics).
## What is this?
This repository contains statistics about the AI Infrastructure community. We collect statistics about the most popular AI Infrastructure projects. We use these statistics to track the growth of the community. This is a work in progress. If you have any suggestions, please open an issue or a pull request.
Currently, we are collecting the following statistics:
- PyPI downloads
- DockerHub pulls
More details about the data collection can be found in the [README](https://github.com/tensorchord/ai-infra-statistics)
## Why don't you collect statistics about X?
We are happy to collect statistics about other AI Infrastructure projects. Please open an [issue or a pull request](https://github.com/tensorchord/ai-infra-statistics).
## Why don't you collect GitHub stars?
Please checkout [star-history.com](https://star-history.com/) if you are interested in GitHub stars.
We do not collect GitHub stars because we believe that GitHub stars are not a good metric for the growth of the community. Please let us know if you have any suggestions for other metrics.
"""
)
st.markdown(
"""
## VectorDB
"""
)
# DockerHub pulls
st.markdown(
"""
### DockerHub Pulls
The data is fetched from [DockerHub API](https://docs.docker.com/docker-hub/api/latest/).
"""
)
data = load_data("vectordb-raw-data-dockerhub.csv")
st.line_chart(data, x="date", y="downloads", color="project")
# PyPI downloads
st.markdown(
"""
### PyPI Downloads (4 months total)
The data is fetched from [pypistats](https://pypistats.org/).
"""
)
data = load_data("vectordb-raw-data-pypi.csv")
st.line_chart(data, x="date", y="downloads", color="project")
st.markdown(
"""
## LLM Orchestration Framework
"""
)
# PyPI downloads
st.markdown(
"""
### PyPI Downloads (4 months total)
The data is fetched from [pypistats](https://pypistats.org/).
"""
)
data = load_data("framework-llm-raw-data-pypi.csv")
st.line_chart(data, x="date", y="downloads", color="project")
st.markdown(
"""
## LLM Inference Framework
"""
)
# PyPI downloads
st.markdown(
"""
### PyPI Downloads (4 months total)
The data is fetched from [pypistats](https://pypistats.org/).
"""
)
data = load_data("framework-inference-raw-data-pypi.csv")
st.line_chart(data, x="date", y="downloads", color="project")
st.markdown(
"""
## Inference as a Service
"""
)
# PyPI downloads
st.markdown(
"""
### PyPI Downloads (4 months total)
The data is fetched from [pypistats](https://pypistats.org/).
"""
)
data = load_data("inference-raw-data-pypi.csv")
st.line_chart(data, x="date", y="downloads", color="project")
st.markdown(
"""
## Inference (Local)
"""
)
# PyPI downloads
st.markdown(
"""
### PyPI Downloads (4 months total)
The data is fetched from [pypistats](https://pypistats.org/).
"""
)
data = load_data("inference-local-raw-data-pypi.csv")
st.line_chart(data, x="date", y="downloads", color="project")