Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

results visualizer #44

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions fall23/deployment/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import streamlit as st
import pandas as pd
import os
import collections

# Define the model metric variable
model_metric = 'VGG-Face_euclidean_l2'
missing_persons = 'missing_filename'
unknown_matches = 'unknowns_matched_filenames'

st.title("Prediction Visualizer")
nav = st.sidebar.radio("Navigation", ['Visualize results'])

# accept csv file as input
uploaded_file = st.sidebar.file_uploader("Choose a CSV file", type="csv")
if uploaded_file is not None:
data = pd.read_csv(uploaded_file)
else:
st.sidebar.write("Please upload a CSV file.")
st.stop()
df = data

if nav == 'Visualize results':
def process_data(user_input):
filtered_df = df[df[missing_persons].str.contains(user_input, na=False)]
st.write()
matches = [x.split(", ") for x in filtered_df[unknown_matches]]
matches = [x for l in matches for x in l]
similarities = [x.split(", ") for x in filtered_df[model_metric]]
similarities = [float(x) for l in similarities for x in l]
res = collections.defaultdict(int)
for i in range(len(matches)):
if similarities[i] > res[matches[i]]:
res[matches[i]] = similarities[i]
res = list(zip(res.keys(), res.values()))
res.sort(key=lambda x: x[1], reverse=True)
return res

def display_results():
threshold = st.session_state.threshold / 100
for image_path, th in results_filtered:
th_val = float(th)
if th_val > threshold:
st.image(image_path, caption = 'Match : {}%'.format(th_val*100), width = 200)
else:
break

user_input = st.text_input("Enter a string to match:")
threshold = st.slider("Select a threshold", key="threshold", min_value=0, max_value=100, value=50, step=1, on_change=display_results)

if st.checkbox("Show Table"):
st.table(data)

if user_input:
results_filtered = process_data(user_input)
if st.checkbox("Show Processed results"):
st.write("Filtered Results: ", results_filtered)
121 changes: 121 additions & 0 deletions fall23/deployment/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
altair==5.1.2
anyio==4.1.0
appnope==0.1.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-lru==2.0.4
attrs==23.1.0
Babel==2.13.1
beautifulsoup4==4.12.2
bleach==6.1.0
blinker==1.7.0
cachetools==5.3.2
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
comm==0.2.0
debugpy==1.8.0
decorator==5.1.1
defusedxml==0.7.1
executing==2.0.1
fastjsonschema==2.19.0
fqdn==1.5.1
gitdb==4.0.11
GitPython==3.1.40
idna==3.5
importlib-metadata==6.8.0
ipykernel==6.26.0
ipython==8.18.0
ipywidgets==8.1.1
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.2
json5==0.9.14
jsonpointer==2.4
jsonschema==4.20.0
jsonschema-specifications==2023.11.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.9.0
jupyter-lsp==2.2.0
jupyter_client==8.6.0
jupyter_core==5.5.0
jupyter_server==2.10.1
jupyter_server_terminals==0.4.4
jupyterlab==4.0.9
jupyterlab-widgets==3.0.9
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.2
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib-inline==0.1.6
mdurl==0.1.2
mistune==3.0.2
nbclient==0.9.0
nbconvert==7.11.0
nbformat==5.9.2
nest-asyncio==1.5.8
notebook==7.0.6
notebook_shim==0.2.3
numpy==1.26.2
overrides==7.4.0
packaging==23.2
pandas==2.1.3
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
Pillow==10.1.0
platformdirs==4.0.0
prometheus-client==0.19.0
prompt-toolkit==3.0.41
protobuf==4.25.1
psutil==5.9.6
ptyprocess==0.7.0
pure-eval==0.2.2
pyarrow==14.0.1
pycparser==2.21
pydeck==0.8.1b0
Pygments==2.17.2
python-dateutil==2.8.2
python-json-logger==2.0.7
pytz==2023.3.post1
PyYAML==6.0.1
pyzmq==25.1.1
qtconsole==5.5.1
QtPy==2.4.1
referencing==0.31.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==13.7.0
rpds-py==0.13.1
Send2Trash==1.8.2
six==1.16.0
smmap==5.0.1
sniffio==1.3.0
soupsieve==2.5
stack-data==0.6.3
streamlit==1.28.2
tenacity==8.2.3
terminado==0.18.0
tinycss2==1.2.1
toml==0.10.2
toolz==0.12.0
tornado==6.3.3
traitlets==5.13.0
types-python-dateutil==2.8.19.14
typing_extensions==4.8.0
tzdata==2023.3
tzlocal==5.2
uri-template==1.3.0
urllib3==2.1.0
validators==0.22.0
wcwidth==0.2.12
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.4
widgetsnbextension==4.0.9
zipp==3.17.0