giobin commited on
Commit
a0aa451
·
verified ·
1 Parent(s): e107527

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -128,8 +128,19 @@ st.markdown("""
128
  """)
129
  st.write("---")
130
 
 
 
 
 
 
 
 
 
 
 
 
131
  # Display video thumbnail
132
- st.video(sample["video_url"])
133
 
134
  # Form for user input
135
  with st.form("annotation_form"):
 
128
  """)
129
  st.write("---")
130
 
131
+
132
+ def convert_youtube_shorts_url(url):
133
+ """Convert a YouTube Shorts URL to a standard YouTube video URL."""
134
+ if "youtube.com/shorts/" in url:
135
+ video_id = url.split("/")[-1].split("?")[0] # Extract the video ID
136
+ return f"https://www.youtube.com/watch?v={video_id}"
137
+ return url
138
+
139
+ fixed_url = convert_youtube_shorts_url(sample["video_url"])
140
+
141
+ st.video(fixed_url)
142
  # Display video thumbnail
143
+ # st.video(sample["video_url"])
144
 
145
  # Form for user input
146
  with st.form("annotation_form"):