Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,7 @@ def youtube_search(query, max_results=50):
|
|
47 |
video_info = {
|
48 |
'thumbnail_url': result["snippet"]["thumbnails"]["high"]["url"],
|
49 |
'video_id': result["id"]["videoId"],
|
50 |
-
'title': result["snippet"]["title"]
|
51 |
-
'description': result["snippet"]["description"] # Include the description
|
52 |
}
|
53 |
all_results.append(video_info)
|
54 |
|
@@ -109,11 +108,6 @@ with gr.Blocks(css="""
|
|
109 |
font-size: 24px !important;
|
110 |
font-weight: bold !important;
|
111 |
}
|
112 |
-
#search_output .gallery-item p {
|
113 |
-
font-size: 96px !important; /* Makes the font four times bigger */
|
114 |
-
font-weight: bold !important; /* Makes the text bold */
|
115 |
-
margin: 0;
|
116 |
-
}
|
117 |
""") as demo:
|
118 |
gr.Markdown("## YouTube Video Search, Selection, and Playback")
|
119 |
video_ids_state = gr.State() # To store video IDs corresponding to the search results
|
@@ -136,10 +130,8 @@ with gr.Blocks(css="""
|
|
136 |
video_ids = []
|
137 |
for item in search_results:
|
138 |
image_url = item['thumbnail_url']
|
139 |
-
title = item['title']
|
140 |
-
|
141 |
-
caption = f"<div><h3>{title}</h3><p>{description}</p></div>" # Include the description as well
|
142 |
-
gallery_items.append((image_url, caption))
|
143 |
video_ids.append(item['video_id'])
|
144 |
return gallery_items, video_ids
|
145 |
|
|
|
47 |
video_info = {
|
48 |
'thumbnail_url': result["snippet"]["thumbnails"]["high"]["url"],
|
49 |
'video_id': result["id"]["videoId"],
|
50 |
+
'title': result["snippet"]["title"]
|
|
|
51 |
}
|
52 |
all_results.append(video_info)
|
53 |
|
|
|
108 |
font-size: 24px !important;
|
109 |
font-weight: bold !important;
|
110 |
}
|
|
|
|
|
|
|
|
|
|
|
111 |
""") as demo:
|
112 |
gr.Markdown("## YouTube Video Search, Selection, and Playback")
|
113 |
video_ids_state = gr.State() # To store video IDs corresponding to the search results
|
|
|
130 |
video_ids = []
|
131 |
for item in search_results:
|
132 |
image_url = item['thumbnail_url']
|
133 |
+
title = item['title'] # Only show the title as plain text
|
134 |
+
gallery_items.append((image_url, title)) # Pass the title directly as plain text
|
|
|
|
|
135 |
video_ids.append(item['video_id'])
|
136 |
return gallery_items, video_ids
|
137 |
|