Commit
·
b313b80
1
Parent(s):
a06400e
Add Content Moderation tab with video processing functionality and updated UI components
Browse files
app.py
CHANGED
|
@@ -50,6 +50,30 @@ def process_audio(original_audio_path, dubbed_audio_path, email, company_name, t
|
|
| 50 |
return "Processing started. Results will be emailed to you shortly."
|
| 51 |
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
# Create a professional Gradio interface using the Golden ratio (1.618) for proportions
|
| 54 |
# Define custom CSS for a professional look
|
| 55 |
css = """
|
|
@@ -289,7 +313,27 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue
|
|
| 289 |
with gr.Row(elem_classes="footer"):
|
| 290 |
gr.Markdown("© BSOD.tv - Professional Dub Quality Control")
|
| 291 |
with gr.Tab("Content Moderation"):
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
|
| 294 |
# Set up the processing function
|
| 295 |
submit_btn.click(
|
|
@@ -298,6 +342,13 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(primary_hue="indigo", secondary_hue
|
|
| 298 |
outputs=output
|
| 299 |
)
|
| 300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
if __name__ == "__main__":
|
| 302 |
# To run this file locally, you'll need to install gradio and requests:
|
| 303 |
# pip install gradio requests
|
|
|
|
| 50 |
return "Processing started. Results will be emailed to you shortly."
|
| 51 |
|
| 52 |
|
| 53 |
+
def process_video(video_path, notes, email, company_name):
|
| 54 |
+
"""
|
| 55 |
+
Process the input video for content moderation.
|
| 56 |
+
Inputs:
|
| 57 |
+
- video_path: path to the uploaded video file (str)
|
| 58 |
+
- notes: department notes (str)
|
| 59 |
+
- email: contact email (str)
|
| 60 |
+
- company_name: company name (str)
|
| 61 |
+
Output:
|
| 62 |
+
- path to the output video file (str)
|
| 63 |
+
For now, this is a placeholder that returns the input video unchanged.
|
| 64 |
+
"""
|
| 65 |
+
try:
|
| 66 |
+
# In a real implementation, you would trigger your backend processing here.
|
| 67 |
+
# For this demo, we simply return the original video path as the output.
|
| 68 |
+
if not video_path:
|
| 69 |
+
# Gradio expects None to clear the output component
|
| 70 |
+
return None
|
| 71 |
+
return video_path
|
| 72 |
+
except Exception as e:
|
| 73 |
+
logger.error(f"Error during video processing: {e}")
|
| 74 |
+
return None
|
| 75 |
+
|
| 76 |
+
|
| 77 |
# Create a professional Gradio interface using the Golden ratio (1.618) for proportions
|
| 78 |
# Define custom CSS for a professional look
|
| 79 |
css = """
|
|
|
|
| 313 |
with gr.Row(elem_classes="footer"):
|
| 314 |
gr.Markdown("© BSOD.tv - Professional Dub Quality Control")
|
| 315 |
with gr.Tab("Content Moderation"):
|
| 316 |
+
# First Row: Left Department Notes (Textbox), Right Video input
|
| 317 |
+
with gr.Row(elem_classes="input-section"):
|
| 318 |
+
with gr.Column(scale=1):
|
| 319 |
+
cm_notes = gr.Textbox(label="Department Notes", lines=6, placeholder="Enter notes for the moderation team...")
|
| 320 |
+
with gr.Column(scale=1):
|
| 321 |
+
cm_video_in = gr.Video(label="Video Input", sources=["upload"], interactive=True)
|
| 322 |
+
|
| 323 |
+
# Second Row: Email and Company Name (2/3 and 1/3 columns)
|
| 324 |
+
with gr.Row(elem_classes="input-section"):
|
| 325 |
+
with gr.Column(scale=2):
|
| 326 |
+
cm_email = gr.Textbox(label="Email")
|
| 327 |
+
with gr.Column(scale=1):
|
| 328 |
+
cm_company_name = gr.Textbox(label="Company Name")
|
| 329 |
+
|
| 330 |
+
# Third Row: Single Video Output
|
| 331 |
+
with gr.Row(elem_classes="output-section"):
|
| 332 |
+
cm_video_out = gr.Video(label="Video Output")
|
| 333 |
+
|
| 334 |
+
# Final Row: Process button
|
| 335 |
+
with gr.Row():
|
| 336 |
+
cm_process_btn = gr.Button("Process", variant="primary")
|
| 337 |
|
| 338 |
# Set up the processing function
|
| 339 |
submit_btn.click(
|
|
|
|
| 342 |
outputs=output
|
| 343 |
)
|
| 344 |
|
| 345 |
+
# Wire Content Moderation processing
|
| 346 |
+
cm_process_btn.click(
|
| 347 |
+
fn=process_video,
|
| 348 |
+
inputs=[cm_video_in, cm_notes, cm_email, cm_company_name],
|
| 349 |
+
outputs=cm_video_out
|
| 350 |
+
)
|
| 351 |
+
|
| 352 |
if __name__ == "__main__":
|
| 353 |
# To run this file locally, you'll need to install gradio and requests:
|
| 354 |
# pip install gradio requests
|