-
Notifications
You must be signed in to change notification settings - Fork 0
/
exifstats.py
48 lines (43 loc) · 1.57 KB
/
exifstats.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
import streamlit as st
import polars as pl
import plotly.express as px
exif_data_file = "./pictures.feather"
def piechart(pie_df, column, title, categorical=True):
if categorical:
colors = px.colors.qualitative.Pastel
else:
colors = px.colors.sequential.Turbo
pie_chart = px.pie(pie_df.to_pandas(),
values="count",
names=column,
title=title,
color_discrete_sequence=colors)
pie_chart.update_traces(textposition='inside', textinfo='percent+label')
st.plotly_chart(pie_chart, use_container_width=True)
def chart_make_model(df):
st.subheader("Camera Makes and Models")
df_make_count = df.groupby("image-make").count().drop_nulls()
df_model_count = df.groupby("image-model").count().drop_nulls()
c1,c2 = st.columns(2)
with c1:
piechart(df_make_count, "image-make", "Camera Makes")
with c2:
piechart(df_model_count, "image-model", "Camera Models")
def chart_iso(df):
st.subheader("Shoot ISO")
df_iso_count = df.groupby("exif-isospeedratings"
).count(
).drop_nulls(
).sort("exif-isospeedratings")
st.write(df_iso_count.to_pandas())
piechart(df_iso_count, "exif-isospeedratings", "Shoot ISO", categorical=False)
st.set_page_config(
page_title="EXIF Statistics",
layout="wide")
st.header("EXIF Statistics")
st.write("2023 - Federico Amedeo Izzo [email protected]")
df = pl.read_ipc(exif_data_file)
with st.expander("Full data"):
st.write(df.to_pandas())
chart_make_model(df)
chart_iso(df)