PBJ commited on
Commit
3956ae6
·
1 Parent(s): 0e16bb3

Update Welcome.py

Browse files
Files changed (1) hide show
  1. Welcome.py +10 -4
Welcome.py CHANGED
@@ -41,8 +41,12 @@ f=st.file_uploader("Please upload a video of a demo of ASL sign", type=['mp4'])
41
  if f is not None:
42
  tfile = tempfile.NamedTemporaryFile(delete=False)
43
  tfile.write(f.read())
44
-
45
- st.video(tfile.name)
 
 
 
 
46
  cap = cv2.VideoCapture(tfile.name)
47
  stframe = st.empty()
48
 
@@ -83,13 +87,15 @@ if f is not None:
83
 
84
  sign_json=pd.read_json("sign_to_prediction_index_map.json",typ='series')
85
  sign_df=pd.DataFrame(sign_json)
86
- sign_df.iloc[sign]
 
87
  top_indices = np.argsort(output['outputs'])[::-1][:5]
88
  top_values = output['outputs'][top_indices]
89
 
90
  output_df = sign_df.iloc[top_indices]
91
  output_df['Value'] = top_values
92
- output_df.rename(columns = {0:'Index'}, inplace = True)
 
93
  st.write(output_df)
94
  # callbacks : on_change, on_click
95
  # com.iframe("https://embed.lottiefiles.com/animation/132349")
 
41
  if f is not None:
42
  tfile = tempfile.NamedTemporaryFile(delete=False)
43
  tfile.write(f.read())
44
+ width = max(30, 0.01)
45
+ side = max((100 - width) / 2, 0.01)
46
+
47
+ _, container, _ = st.columns([side, width, side])
48
+ container.video(data=tfile.name)
49
+ # st.video(tfile.name)
50
  cap = cv2.VideoCapture(tfile.name)
51
  stframe = st.empty()
52
 
 
87
 
88
  sign_json=pd.read_json("sign_to_prediction_index_map.json",typ='series')
89
  sign_df=pd.DataFrame(sign_json)
90
+ pred=sign_df.iloc[sign]
91
+ st.write(f"### Sign : {pred}")
92
  top_indices = np.argsort(output['outputs'])[::-1][:5]
93
  top_values = output['outputs'][top_indices]
94
 
95
  output_df = sign_df.iloc[top_indices]
96
  output_df['Value'] = top_values
97
+ output_df.drop(['0'], inplace=True)
98
+ # output_df.rename(columns = {0:'Index'}, inplace = True)
99
  st.write(output_df)
100
  # callbacks : on_change, on_click
101
  # com.iframe("https://embed.lottiefiles.com/animation/132349")