PierreBrunelle
commited on
Commit
•
83f9cc7
1
Parent(s):
da976ea
Update app.py
Browse files
app.py
CHANGED
@@ -68,6 +68,9 @@ def process_and_generate_post(video_file, social_media_type):
|
|
68 |
return "Please upload a video file.", None
|
69 |
|
70 |
try:
|
|
|
|
|
|
|
71 |
# Check video file size
|
72 |
video_size = os.path.getsize(video_file) / (1024 * 1024) # Convert to MB
|
73 |
if video_size > MAX_VIDEO_SIZE_MB:
|
@@ -79,15 +82,23 @@ def process_and_generate_post(video_file, social_media_type):
|
|
79 |
"sm_type": social_media_type
|
80 |
}])
|
81 |
|
|
|
|
|
82 |
# Retrieve Social media posts
|
83 |
social_media_post = t.select(t.answer).tail(1)['answer'][0]
|
84 |
|
|
|
|
|
85 |
# Retrieve Audio
|
86 |
audio = t.select(t.audio).tail(1)['audio'][0]
|
87 |
|
|
|
|
|
88 |
# Retrieve thumbnails
|
89 |
thumbnails = frames_view.select(frames_view.frame).tail(6)['frame']
|
90 |
|
|
|
|
|
91 |
# Retrieve Pixeltable Table containing all videos and stored data
|
92 |
df_output = t.select(t.transcription_text).collect().to_pandas()
|
93 |
|
@@ -105,9 +116,15 @@ def gradio_interface():
|
|
105 |
gr.Markdown("""
|
106 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/source/data/pixeltable-logo-large.png" alt="Pixeltable" width="20%" /></img>
|
107 |
<h1>Video to Social Media Post Generator</h1>
|
108 |
-
Pixeltable is a declarative interface for working with text, images, embeddings, and even video, enabling you to store, transform, index, and iterate on data. Powered solely by Pixeltable, running OpenAI (gpt-4o-mini-2024-07-18).
|
109 |
"""
|
110 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
with gr.Row():
|
112 |
with gr.Column():
|
113 |
gr.Markdown("""
|
|
|
68 |
return "Please upload a video file.", None
|
69 |
|
70 |
try:
|
71 |
+
|
72 |
+
progress(0, desc="Initializing...")
|
73 |
+
|
74 |
# Check video file size
|
75 |
video_size = os.path.getsize(video_file) / (1024 * 1024) # Convert to MB
|
76 |
if video_size > MAX_VIDEO_SIZE_MB:
|
|
|
82 |
"sm_type": social_media_type
|
83 |
}])
|
84 |
|
85 |
+
progress(0.2, desc="Extracting audio and frames...")
|
86 |
+
|
87 |
# Retrieve Social media posts
|
88 |
social_media_post = t.select(t.answer).tail(1)['answer'][0]
|
89 |
|
90 |
+
progress(0.4, desc="Transcribing audio...")
|
91 |
+
|
92 |
# Retrieve Audio
|
93 |
audio = t.select(t.audio).tail(1)['audio'][0]
|
94 |
|
95 |
+
progress(0.6, desc="Generating posts...")
|
96 |
+
|
97 |
# Retrieve thumbnails
|
98 |
thumbnails = frames_view.select(frames_view.frame).tail(6)['frame']
|
99 |
|
100 |
+
progress(0.8, desc="Preparing results...")
|
101 |
+
|
102 |
# Retrieve Pixeltable Table containing all videos and stored data
|
103 |
df_output = t.select(t.transcription_text).collect().to_pandas()
|
104 |
|
|
|
116 |
gr.Markdown("""
|
117 |
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/source/data/pixeltable-logo-large.png" alt="Pixeltable" width="20%" /></img>
|
118 |
<h1>Video to Social Media Post Generator</h1>
|
|
|
119 |
"""
|
120 |
)
|
121 |
+
gr.HTML(
|
122 |
+
"""
|
123 |
+
<p>
|
124 |
+
<a href="https://github.com/pixeltable/pixeltable" target="_blank" style="color: #F25022; text-decoration: none; font-weight: bold;">Pixeltable</a> is a declarative interface for working with text, images, embeddings, and even video, enabling you to store, transform, index, and iterate on data.
|
125 |
+
</p>
|
126 |
+
"""
|
127 |
+
)
|
128 |
with gr.Row():
|
129 |
with gr.Column():
|
130 |
gr.Markdown("""
|