natexcvi commited on
Commit
305a8f8
1 Parent(s): b1a811a

Initial commit

Browse files
Files changed (2) hide show
  1. app.py +25 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import streamlit as st
3
+
4
+ access_token = st.experimental_get_query_params().get("token", [""])[0]
5
+
6
+ if access_token == "":
7
+ st.error("Access denied")
8
+ st.stop()
9
+
10
+ static_image = st.file_uploader("Upload image", type=["png", "jpg", "jpeg"])
11
+
12
+ img_file_buffer = st.camera_input("Take a picture")
13
+
14
+ if img_file_buffer is not None and static_image is not None:
15
+ res = requests.post(
16
+ "https://natexcvi-facialexpressionsyncservice.hf.space/similarity",
17
+ files={
18
+ "image1": img_file_buffer.getvalue(),
19
+ "image2": static_image.getvalue(),
20
+ },
21
+ params={
22
+ "token": access_token,
23
+ },
24
+ )
25
+ st.metric("Similarity", res.json()["score"])
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ requests