awacke1 commited on
Commit
383eddc
Β·
verified Β·
1 Parent(s): 6beb55e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -2039,12 +2039,14 @@ for file in audio_files:
2039
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2040
  with col1:
2041
  st.markdown(file)
2042
- if st.button("🎡", key="play_" + file): # play emoji button
 
2043
  audio_file = open(file, 'rb')
2044
  audio_bytes = audio_file.read()
2045
  st.audio(audio_bytes, format='audio/wav')
2046
  with col2:
2047
- if st.button("πŸ—‘", key="delete_" + file):
 
2048
  os.remove(file)
2049
  st.rerun()
2050
 
@@ -2053,7 +2055,8 @@ for file in image_files:
2053
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2054
  with col1:
2055
  st.markdown(file)
2056
- if st.button("πŸ–Ό", key="show_" + file): # show emoji button
 
2057
  image = open(file, 'rb').read()
2058
  st.image(image)
2059
  with col2:
@@ -2066,12 +2069,14 @@ for file in video_files:
2066
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2067
  with col1:
2068
  st.markdown(file)
2069
- if st.button("πŸŽ₯", key="play_" + file): # play emoji button
 
2070
  video_file = open(file, 'rb')
2071
  video_bytes = video_file.read()
2072
  st.video(video_bytes)
2073
  with col2:
2074
- if st.button("πŸ—‘", key="delete_" + file):
 
2075
  os.remove(file)
2076
  st.rerun()
2077
 
@@ -2080,12 +2085,14 @@ for file in video_files_mp3:
2080
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2081
  with col1:
2082
  st.markdown(file)
2083
- if st.button("πŸŽ₯", key="play_" + file): # play emoji button
 
2084
  video_file = open(file, 'rb')
2085
  video_bytes = video_file_mp3.read()
2086
  st.video(video_bytes)
2087
  with col2:
2088
- if st.button("πŸ—‘", key="delete_" + file):
 
2089
  os.remove(file)
2090
  st.rerun()
2091
 
 
2039
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2040
  with col1:
2041
  st.markdown(file)
2042
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2043
+ if st.button("🎡", key="play_" + file + unique_key): # play emoji button
2044
  audio_file = open(file, 'rb')
2045
  audio_bytes = audio_file.read()
2046
  st.audio(audio_bytes, format='audio/wav')
2047
  with col2:
2048
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2049
+ if st.button("πŸ—‘", key="delete_" + file + unique_key):
2050
  os.remove(file)
2051
  st.rerun()
2052
 
 
2055
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2056
  with col1:
2057
  st.markdown(file)
2058
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2059
+ if st.button("πŸ–Ό", key="show_" + file + unique_key): # show emoji button
2060
  image = open(file, 'rb').read()
2061
  st.image(image)
2062
  with col2:
 
2069
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2070
  with col1:
2071
  st.markdown(file)
2072
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2073
+ if st.button("πŸŽ₯", key="play_" + file + unique_key): # play emoji button
2074
  video_file = open(file, 'rb')
2075
  video_bytes = video_file.read()
2076
  st.video(video_bytes)
2077
  with col2:
2078
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2079
+ if st.button("πŸ—‘", key="delete_" + file + unique_key):
2080
  os.remove(file)
2081
  st.rerun()
2082
 
 
2085
  col1, col2 = st.sidebar.columns([6, 1]) # adjust the ratio as needed
2086
  with col1:
2087
  st.markdown(file)
2088
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2089
+ if st.button("πŸŽ₯", key="play_" + file + unique_key): # play emoji button
2090
  video_file = open(file, 'rb')
2091
  video_bytes = video_file_mp3.read()
2092
  st.video(video_bytes)
2093
  with col2:
2094
+ unique_key = hashlib.sha256(str(time.time()).encode()).hexdigest()
2095
+ if st.button("πŸ—‘", key="delete_" + file + unique_key):
2096
  os.remove(file)
2097
  st.rerun()
2098