Skip to content

Instantly share code, notes, and snippets.

@bigsnarfdude
Created March 19, 2025 16:42
Show Gist options
  • Save bigsnarfdude/116c0ef654a44400d70ef73bef8428cf to your computer and use it in GitHub Desktop.
Save bigsnarfdude/116c0ef654a44400d70ef73bef8428cf to your computer and use it in GitHub Desktop.
video_viz.py
from flask import Flask, render_template
import altair as alt
import pandas as pd
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/chart')
def chart_json():
data = {
'Year': [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024],
'Video Count': [960, 1009, 1471, 1473, 1420, 1567, 1177, 407, 1003, 1083, 1062, 1377]
}
df = pd.DataFrame(data)
chart = alt.Chart(df).mark_line().encode(
x=alt.X('Year:Q', title='Year'),
y=alt.Y('Video Count:Q', title='Video Count'),
tooltip=['Year', 'Video Count']
).properties(
title='Video Count Over Time (Excluding 2025)'
).interactive()
return chart.to_json()
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment