Spaces:
Runtime error
Runtime error
File size: 1,038 Bytes
a26f7a8 305a8f8 c7f7ce9 305a8f8 c7f7ce9 a26f7a8 c7f7ce9 305a8f8 efa7d7f c7f7ce9 3516992 c7f7ce9 efa7d7f 3516992 a9cf259 3516992 c7f7ce9 1fbfe55 c7f7ce9 efa7d7f c7f7ce9 |
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 |
import stat
import requests
import streamlit as st
from api import FacialSyncService
access_token = st.experimental_get_query_params().get("token", [""])[0]
if access_token == "":
st.error("Access denied")
st.stop()
api = FacialSyncService(access_token)
st.title("🤪 Facial Expression Sync Service")
img_file_buffer = st.camera_input("Take a picture")
st.write("### Compare with static images")
col1, col2 = st.columns(2)
for i, col in enumerate([col1, col2]):
with col:
img_cont = st.container()
static_image = st.file_uploader(
f"Upload image {i+1}",
type=["png", "jpg", "jpeg"],
key=f"static_img_uploader_{i}",
)
if static_image is not None:
img_cont.image(static_image, caption=f"Image {i+1}", width=200)
if img_file_buffer is not None:
img_cont.metric(
"Similarity",
f"{api.similarity(img_file_buffer.getvalue(), static_image.getvalue()):.2f}",
)
|