Spaces:
Runtime error
Runtime error
Merge branch 'content-moderation-implementation' into 'main'
Browse files49 unmodified lines505152535455197 unmodified lines2532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912 unmodified lines29429529629729829949 unmodified linesreturn "Processing started. Results will be emailed to you shortly."# Create a professional Gradio interface using the Golden ratio (1.618) for proportions# Define custom CSS for a professional lookcss = """197 unmodified lines""")# Main content with specified layout# First Row: Half Original Audio Input, Half Dubbed Audio Inputwith gr.Row(elem_classes="input-section"):with gr.Column(scale=1):original_audio = gr.Audio(type="filepath", label="Original .wav file", sources=['upload'],format="wav")with gr.Column(scale=1):dubbed_audio = gr.Audio(type="filepath", label="Dubbed .wav file", sources=['upload'],format="wav")# Second Row: 2/3 Email Input 1/3 Company Name Inputwith gr.Row(elem_classes="input-section"):with gr.Column(scale=2):_email = gr.Textbox(label="Email")with gr.Column(scale=1):_company_name = gr.Textbox(label="Company Name")# Third Row: Tolerance Percentagewith gr.Row(elem_classes="input-section"):_tolerance = gr.Slider(0, 100, value=5, label="Tolerance Percentage",info="Set the tolerance for audio comparison.")# Fourth Row: Processing Statuswith gr.Row(elem_classes="output-section"):output = gr.Text(label="Processing Status")with gr.Row():submit_btn = gr.Button("Process Audio", variant="primary")with gr.Row():gr.Markdown("### Results")gr.Markdown("Once processing is complete, results will be emailed to the address provided.")# Footerwith gr.Row(elem_classes="footer"):gr.Markdown("© BSOD.tv - Professional Dub Quality Control")# Set up the processing functionsubmit_btn.click(2 unmodified linesoutputs=output)if __name__ == "__main__":# To run this file locally, you'll need to install gradio and requests:# pip install gradio requests49 unmodified lines505152535455565758596061626364656667686970717273747576777879197 unmodified lines2772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383392 unmodified lines34234334434534634734834935035135235335449 unmodified linesreturn "Processing started. Results will be emailed to you shortly."def process_video(video_path, notes, email, company_name):"""Process the input video for content moderation.Inputs:- video_path: path to the uploaded video file (str)- notes: department notes (str)- email: contact email (str)- company_name: company name (str)Output:- path to the output video file (str)For now, this is a placeholder that returns the input video unchanged."""try:# In a real implementation, you would trigger your backend processing here.# For this demo, we simply return the original video path as the output.if not video_path:# Gradio expects None to clear the output componentreturn Nonereturn video_pathexcept Exception as e:logger.error(f"Error during video processing: {e}")return None# Create a professional Gradio interface using the Golden ratio (1.618) for proportions# Define custom CSS for a professional lookcss = """197 unmodified lines""")# Main content with specified layoutwith gr.Tabs():with gr.Tab("Dub Quality Control"):# First Row: Half Original Audio Input, Half Dubbed Audio Inputwith gr.Row(elem_classes="input-section"):with gr.Column(scale=1):original_audio = gr.Audio(type="filepath", label="Original .wav file", sources=['upload'],format="wav")with gr.Column(scale=1):dubbed_audio = gr.Audio(type="filepath", label="Dubbed .wav file", sources=['upload'],format="wav")# Second Row: 2/3 Email Input 1/3 Company Name Inputwith gr.Row(elem_classes="input-section"):with gr.Column(scale=2):_email = gr.Textbox(label="Email")with gr.Column(scale=1):_company_name = gr.Textbox(label="Company Name")# Third Row: Tolerance Percentagewith gr.Row(elem_classes="input-section"):_tolerance = gr.Slider(0, 100, value=5, label="Tolerance Percentage",info="Set the tolerance for audio comparison.")# Fourth Row: Processing Statuswith gr.Row(elem_classes="output-section"):output = gr.Text(label="Processing Status")with gr.Row():submit_btn = gr.Button("Process Audio", variant="primary")with gr.Row():gr.Markdown("### Results")gr.Markdown("Once processing is complete, results will be emailed to the address provided.")# Footerwith gr.Row(elem_classes="footer"):gr.Markdown("© BSOD.tv - Professional Dub Quality Control")with gr.Tab("Content Moderation"):# First Row: Left Department Notes (Textbox), Right Video inputwith gr.Row(elem_classes="input-section"):with gr.Column(scale=1):cm_notes = gr.Textbox(label="Department Notes", lines=6, placeholder="Enter notes for the moderation team...")with gr.Column(scale=1):cm_video_in = gr.Video(label="Video Input", sources=["upload"], interactive=True)# Second Row: Email and Company Name (2/3 and 1/3 columns)with gr.Row(elem_classes="input-section"):with gr.Column(scale=2):cm_email = gr.Textbox(label="Email")with gr.Column(scale=1):cm_company_name = gr.Textbox(label="Company Name")# Third Row: Single Video Outputwith gr.Row(elem_classes="output-section"):cm_video_out = gr.Video(label="Video Output")# Final Row: Process buttonwith gr.Row():cm_process_btn = gr.Button("Process", variant="primary")# Set up the processing functionsubmit_btn.click(2 unmodified linesoutputs=output)# Wire Content Moderation processingcm_process_btn.click(fn=process_video,inputs=[cm_video_in, cm_notes, cm_email, cm_company_name],outputs=cm_video_out)if __name__ == "__main__":# To run this file locally, you'll need to install gradio and requests:# pip install gradio requests
app.py+88-33