Update app.py
Browse files
app.py
CHANGED
@@ -145,7 +145,7 @@ def mock_analytics():
|
|
145 |
}
|
146 |
|
147 |
# Core functionalities
|
148 |
-
def upload_and_manage(file,
|
149 |
if file is None:
|
150 |
return "Please upload a video/audio file.", None, None, None
|
151 |
|
@@ -163,54 +163,53 @@ def upload_and_manage(file, platform, language):
|
|
163 |
add_transcript_to_video(file.name, translated_json, output_video_path)
|
164 |
|
165 |
# Mock posting action (you can implement this as needed)
|
166 |
-
post_message = mock_post_to_platform(platform, file.name)
|
167 |
|
168 |
-
return
|
169 |
|
170 |
-
def generate_dashboard():
|
171 |
-
|
172 |
-
|
173 |
|
174 |
-
|
175 |
-
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
|
184 |
-
# Gradio Interface with Tabs
|
185 |
# Gradio Interface with Tabs
|
186 |
def build_interface():
|
187 |
with gr.Blocks() as demo:
|
188 |
-
with gr.Tab("Content Management"):
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
|
215 |
return demo
|
216 |
|
|
|
145 |
}
|
146 |
|
147 |
# Core functionalities
|
148 |
+
def upload_and_manage(file, language):
|
149 |
if file is None:
|
150 |
return "Please upload a video/audio file.", None, None, None
|
151 |
|
|
|
163 |
add_transcript_to_video(file.name, translated_json, output_video_path)
|
164 |
|
165 |
# Mock posting action (you can implement this as needed)
|
166 |
+
# post_message = mock_post_to_platform(platform, file.name)
|
167 |
|
168 |
+
return transcrption_json, translated_json, output_video_path
|
169 |
|
170 |
+
# def generate_dashboard():
|
171 |
+
# # Mock analytics generation
|
172 |
+
# analytics = mock_analytics()
|
173 |
|
174 |
+
# if not analytics:
|
175 |
+
# return "No analytics available."
|
176 |
|
177 |
+
# dashboard = "Platform Analytics:\n"
|
178 |
+
# for platform, data in analytics.items():
|
179 |
+
# dashboard += f"\n{platform}:\n"
|
180 |
+
# for metric, value in data.items():
|
181 |
+
# dashboard += f" {metric}: {value}\n"
|
182 |
+
# return dashboard
|
183 |
|
|
|
184 |
# Gradio Interface with Tabs
|
185 |
def build_interface():
|
186 |
with gr.Blocks() as demo:
|
187 |
+
# with gr.Tab("Content Management"):
|
188 |
+
gr.Markdown("## Video Localization")
|
189 |
+
with gr.Row():
|
190 |
+
file_input = gr.File(label="Upload Video/Audio File")
|
191 |
+
# platform_input = gr.Dropdown(["YouTube", "Instagram"], label="Select Platform")
|
192 |
+
language_input = gr.Dropdown(["en", "es", "fr", "zh"], label="Select Language") # Language codes
|
193 |
+
|
194 |
+
submit_button = gr.Button("Post and Process")
|
195 |
+
with gr.Row():
|
196 |
+
# post_output = gr.Textbox(label="Posting Status", interactive=False)
|
197 |
+
transcription_output = gr.JSON(label="Transcription JSON File")
|
198 |
+
translated_output = gr.JSON(label="Translated JSON File")
|
199 |
+
with gr.Row():
|
200 |
+
processed_video_output = gr.File(label="Download Processed Video", interactive=False) # Download button
|
201 |
+
submit_button.click(
|
202 |
+
upload_and_manage,
|
203 |
+
inputs=[file_input, language_input],
|
204 |
+
outputs=[transcription_output, translated_output, processed_video_output]
|
205 |
+
)
|
206 |
+
|
207 |
+
# with gr.Tab("Analytics Dashboard"):
|
208 |
+
# gr.Markdown("## Content Performance Analytics")
|
209 |
+
# analytics_output = gr.Textbox(label="Dashboard", interactive=False)
|
210 |
+
# generate_dashboard_button = gr.Button("Generate Dashboard")
|
211 |
+
|
212 |
+
# generate_dashboard_button.click(generate_dashboard, outputs=[analytics_output])
|
213 |
|
214 |
return demo
|
215 |
|