mobenta commited on
Commit
a75fa95
·
verified ·
1 Parent(s): 4f264df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -24
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"]
52
  }
53
  all_results.append(video_info)
54
 
@@ -94,33 +93,20 @@ def show_video(video_url):
94
  # Create the Gradio interface
95
  with gr.Blocks(css="""
96
  #search_output img {
97
- width: 200px !important;
98
- height: 200px !important;
99
  margin-right: 20px;
100
  }
101
- #search_output .label {
102
- font-size: 36px !important;
103
- }
104
  #search_output .gallery-item {
105
  display: flex !important;
106
- align-items: flex-start !important;
107
- margin-bottom: 60px !important;
108
  }
109
  #search_output .gallery-caption {
110
  text-align: left !important;
111
  padding-left: 20px;
112
- }
113
- #search_output .gallery-item div {
114
- display: flex;
115
- flex-direction: column;
116
- }
117
- #search_output .gallery-item h3 {
118
- font-size: 36px;
119
- margin: 0 0 10px 0;
120
- }
121
- #search_output .gallery-item p {
122
- font-size: 24px;
123
- margin: 0;
124
  }
125
  """) as demo:
126
  gr.Markdown("## YouTube Video Search, Selection, and Playback")
@@ -144,9 +130,8 @@ with gr.Blocks(css="""
144
  video_ids = []
145
  for item in search_results:
146
  image_url = item['thumbnail_url']
147
- title = item['title']
148
- description = item['description']
149
- caption = f"<div><h3>{title}</h3><p>{description}</p></div>"
150
  gallery_items.append((image_url, caption))
151
  video_ids.append(item['video_id'])
152
  return gallery_items, video_ids
 
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
  # Create the Gradio interface
94
  with gr.Blocks(css="""
95
  #search_output img {
96
+ width: 170px !important;
97
+ height: 170px !important;
98
  margin-right: 20px;
99
  }
 
 
 
100
  #search_output .gallery-item {
101
  display: flex !important;
102
+ align-items: center !important;
103
+ margin-bottom: 30px !important;
104
  }
105
  #search_output .gallery-caption {
106
  text-align: left !important;
107
  padding-left: 20px;
108
+ font-size: 100px !important;
109
+ font-weight: bold !important;
 
 
 
 
 
 
 
 
 
 
110
  }
111
  """) as demo:
112
  gr.Markdown("## YouTube Video Search, Selection, and Playback")
 
130
  video_ids = []
131
  for item in search_results:
132
  image_url = item['thumbnail_url']
133
+ title = item['title'] # Only show the title
134
+ caption = f"<div><h3>{title}</h3></div>" # Use only the title
 
135
  gallery_items.append((image_url, caption))
136
  video_ids.append(item['video_id'])
137
  return gallery_items, video_ids