RaphaelLiu commited on
Commit
6b21ea0
·
1 Parent(s): b66c8f8

Update content

Browse files
Files changed (1) hide show
  1. app.py +37 -12
app.py CHANGED
@@ -11,6 +11,12 @@ body, html {
11
  width: 100%;
12
  }
13
 
 
 
 
 
 
 
14
  .gallery-container {
15
  display: flex;
16
  flex-direction: column;
@@ -30,11 +36,23 @@ body, html {
30
  max-width: 1200px;
31
  }
32
 
 
33
  .video-item {
34
- padding-top: 0;
35
- margin-bottom: 1rem;
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
 
38
  .video-item video {
39
  width: 100%;
40
  display: block;
@@ -45,7 +63,8 @@ body, html {
45
  padding: 0.5rem;
46
  border-radius: 4px;
47
  margin-top: 0.5rem;
48
- font-size: 0.9rem;
 
49
  display: block;
50
  width: auto;
51
  }
@@ -94,10 +113,11 @@ a:hover {
94
  color: #a4c2ff; /* Lighter blue on hover for visibility */
95
  }
96
 
 
97
  input[type="text"], select, textarea {
98
  background-color: #333333; /* Dark grey input background for contrast */
99
  color: #e0e0e0; /* White text for inputs */
100
- border: 1px solid #343434; /* Subtle border color */
101
  border-radius: 0.3rem;
102
  padding: 0.5rem;
103
  }
@@ -195,18 +215,23 @@ def showcase(page_num):
195
  for i in range(start_index, end_index):
196
  video_name = f"{i:04d}.mp4"
197
  caption_name = f"{i:04d}.txt"
 
 
 
 
 
 
198
  video_html += "<div class='video-container'>"
 
 
 
 
 
199
 
200
  for category in ['VideoCrafter2', 'Pika', 'VideoCrafter1', 'VideoCrafter0.9', 'Pika1.0', 'Gen2-09.2023', 'Gen2-12.2023', 'HotShot', 'Lavie-Base', 'Lavie-Interpolation', 'ModelScope', 'MoonValley', 'Show1', 'ZeroScope']:
201
  video_path = f"./{category}/{video_name}" # Updated to use local path
202
  # video_path = f"./0000.mp4" # Updated to use local path
203
- caption_path = os.path.join('prompts', caption_name)
204
  if os.path.exists(video_path):
205
- caption_text = ""
206
- if os.path.exists(caption_path):
207
- with open(caption_path, 'r') as file:
208
- caption_text = file.read().strip()
209
-
210
  # Convert video to Base64 for embedding if necessary
211
  video_base64 = video_to_base64(video_path)
212
  video_html += f"""
@@ -215,7 +240,7 @@ def showcase(page_num):
215
  <source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
216
  Your browser does not support the video tag.
217
  </video>
218
- <p class='video-caption'>{category}: {caption_text}</p>
219
  </div>
220
  """
221
 
@@ -226,7 +251,7 @@ def showcase(page_num):
226
  # Description and Acknowledgements
227
 
228
  description_html = """
229
- <div style="text-align: center; margin-bottom: 20px;">
230
  <p>
231
  <a href="https://huggingface.co/datasets/RaphaelLiu/EvalCrafter_T2V_Dataset">Dataset</a> ·
232
  <a href="https://github.com/EvalCrafter/EvalCrafter">Code</a> ·
 
11
  width: 100%;
12
  }
13
 
14
+ .caption-row {
15
+ width: 100%;
16
+ text-align: center;
17
+ margin-bottom: -10px; /* Adjust as needed for spacing */
18
+ }
19
+
20
  .gallery-container {
21
  display: flex;
22
  flex-direction: column;
 
36
  max-width: 1200px;
37
  }
38
 
39
+
40
  .video-item {
41
+ position: relative;
42
+ width: 100%; /* Set to the width you desire */
43
+ padding-top: 56.25%; /* 16:9 Aspect Ratio */
44
+ }
45
+
46
+ video {
47
+ position: absolute;
48
+ top: 0;
49
+ left: 0;
50
+ width: 100%;
51
+ height: 83%;
52
+ object-fit: cover; /* This will cover the area of the video-item, you can also use 'contain' to fit inside the area */
53
  }
54
 
55
+
56
  .video-item video {
57
  width: 100%;
58
  display: block;
 
63
  padding: 0.5rem;
64
  border-radius: 4px;
65
  margin-top: 0.5rem;
66
+ font-size: 1.1rem;
67
+ text-align: center;
68
  display: block;
69
  width: auto;
70
  }
 
113
  color: #a4c2ff; /* Lighter blue on hover for visibility */
114
  }
115
 
116
+
117
  input[type="text"], select, textarea {
118
  background-color: #333333; /* Dark grey input background for contrast */
119
  color: #e0e0e0; /* White text for inputs */
120
+ border: -1px solid #343434; /* Subtle border color */
121
  border-radius: 0.3rem;
122
  padding: 0.5rem;
123
  }
 
215
  for i in range(start_index, end_index):
216
  video_name = f"{i:04d}.mp4"
217
  caption_name = f"{i:04d}.txt"
218
+ caption_path = os.path.join('prompts', caption_name)
219
+
220
+ if os.path.exists(caption_path):
221
+ with open(caption_path, 'r') as file:
222
+ caption_text = file.read().strip()
223
+ video_html += f"""<h1 align="center">Prompt: {caption_text}</h1>"""
224
  video_html += "<div class='video-container'>"
225
+ # Add the caption at the top of the page, outside the video loop
226
+ # video_html += f"<div class='video-caption'>{caption_text}</div>"
227
+ # video_html += f"<div class='caption-row'><div class='video-caption'>{caption_text}</div></div>"
228
+ # video_html += f"<div class='caption-row'>{caption_text}</div>"
229
+
230
 
231
  for category in ['VideoCrafter2', 'Pika', 'VideoCrafter1', 'VideoCrafter0.9', 'Pika1.0', 'Gen2-09.2023', 'Gen2-12.2023', 'HotShot', 'Lavie-Base', 'Lavie-Interpolation', 'ModelScope', 'MoonValley', 'Show1', 'ZeroScope']:
232
  video_path = f"./{category}/{video_name}" # Updated to use local path
233
  # video_path = f"./0000.mp4" # Updated to use local path
 
234
  if os.path.exists(video_path):
 
 
 
 
 
235
  # Convert video to Base64 for embedding if necessary
236
  video_base64 = video_to_base64(video_path)
237
  video_html += f"""
 
240
  <source src="data:video/mp4;base64,{video_base64}" type="video/mp4">
241
  Your browser does not support the video tag.
242
  </video>
243
+ <p class='video-caption'>{category}</p>
244
  </div>
245
  """
246
 
 
251
  # Description and Acknowledgements
252
 
253
  description_html = """
254
+ <div style="text-align: center; margin-bottom: 20px;font-size: 1.1rem;">
255
  <p>
256
  <a href="https://huggingface.co/datasets/RaphaelLiu/EvalCrafter_T2V_Dataset">Dataset</a> ·
257
  <a href="https://github.com/EvalCrafter/EvalCrafter">Code</a> ·