mobenta commited on
Commit
9af8098
·
verified ·
1 Parent(s): 2ff0549

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -47,7 +47,8 @@ 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
  }
52
  all_results.append(video_info)
53
 
@@ -93,9 +94,9 @@ def show_video(video_url):
93
  # Create the Gradio interface
94
  with gr.Blocks(css="""
95
  #search_output img {
96
- width: 150px !important;
97
- height: 150px !important;
98
- margin-right: 5px;
99
  }
100
  #search_output .gallery-item {
101
  display: flex !important;
@@ -108,6 +109,11 @@ with gr.Blocks(css="""
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,8 +136,10 @@ with gr.Blocks(css="""
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
 
 
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
 
 
94
  # Create the Gradio interface
95
  with gr.Blocks(css="""
96
  #search_output img {
97
+ width: 500px !important;
98
+ height: auto !important;
99
+ margin-right: 20px;
100
  }
101
  #search_output .gallery-item {
102
  display: flex !important;
 
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
  video_ids = []
137
  for item in search_results:
138
  image_url = item['thumbnail_url']
139
+ title = item['title']
140
+ description = item['description']
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