chuanenlin commited on
Commit
42b8f89
β€’
1 Parent(s): ad9de9f

Update desc

Browse files
Files changed (1) hide show
  1. whichframe.py +4 -8
whichframe.py CHANGED
@@ -64,10 +64,7 @@ def display_results(best_photo_idx):
64
  seconds = round(frame_id.cpu().numpy()[0] * N / ss.fps)
65
  result_arr.append(seconds)
66
  time = format_timespan(seconds)
67
- if ss.input == "file":
68
- st.write("Seen at " + str(time) + " into the video.")
69
- else:
70
- st.markdown("Seen at [" + str(time) + "](" + url + "&t=" + str(seconds) + "s) into the video.")
71
  return result_arr
72
 
73
  def text_search(search_query, display_results_count=5):
@@ -94,11 +91,11 @@ hide_streamlit_style = """
94
  """
95
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
96
 
97
- ss = SessionState.get(url=None, id=None, input=None, file_name=None, video=None, video_name=None, video_frames=None, video_features=None, fps=None, mode=None, query=None, progress=1)
98
 
99
  st.title("Which Frame?")
100
  st.markdown("✨**Semantic**✨ video search.")
101
- st.markdown("Example: Which video frame has a person πŸ§‘ with sunglasses πŸ•ΆοΈ and earphones 🎧?")
102
  url = st.text_input("Enter YouTube video URL (Example: https://www.youtube.com/watch?v=sxaTnm_4YMY)")
103
 
104
  N = 30
@@ -110,12 +107,11 @@ if st.button("Process video"):
110
  ss.progress = 1
111
  ss.video_start_time = 0
112
  if url:
113
- ss.input = "link"
114
  ss.video, ss.video_name = fetch_video(url)
115
  ss.id = extract.video_id(url)
116
  ss.url = "https://www.youtube.com/watch?v=" + ss.id
117
  else:
118
- st.error("Please upload a video or link to a valid YouTube video")
119
  st.stop()
120
  ss.video_frames, ss.fps = extract_frames(ss.video_name)
121
  ss.video_features = encode_frames(ss.video_frames)
 
64
  seconds = round(frame_id.cpu().numpy()[0] * N / ss.fps)
65
  result_arr.append(seconds)
66
  time = format_timespan(seconds)
67
+ st.markdown("Seen at [" + str(time) + "](" + url + "&t=" + str(seconds) + "s) into the video.")
 
 
 
68
  return result_arr
69
 
70
  def text_search(search_query, display_results_count=5):
 
91
  """
92
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
93
 
94
+ ss = SessionState.get(url=None, id=None, file_name=None, video=None, video_name=None, video_frames=None, video_features=None, fps=None, mode=None, query=None, progress=1)
95
 
96
  st.title("Which Frame?")
97
  st.markdown("✨**Semantic**✨ video search.")
98
+ st.markdown("For example, which video frame has a person πŸ§‘ with sunglasses πŸ•ΆοΈ and earphones 🎧?")
99
  url = st.text_input("Enter YouTube video URL (Example: https://www.youtube.com/watch?v=sxaTnm_4YMY)")
100
 
101
  N = 30
 
107
  ss.progress = 1
108
  ss.video_start_time = 0
109
  if url:
 
110
  ss.video, ss.video_name = fetch_video(url)
111
  ss.id = extract.video_id(url)
112
  ss.url = "https://www.youtube.com/watch?v=" + ss.id
113
  else:
114
+ st.error("Please link to a valid YouTube video")
115
  st.stop()
116
  ss.video_frames, ss.fps = extract_frames(ss.video_name)
117
  ss.video_features = encode_frames(ss.video_frames)