Update app.py
Browse files65 unmodified lines66676869707172114 unmodified lines18718818919019119219319415 unmodified lines21021121221321421521621721821922022165 unmodified linesmerge_chunks(chunk_files, output_file_path)# Verify file integrityoriginal_hash = calculate_sha256(output_file_path)return f"SHA-256 hash of the decoded file: {original_hash}"def convert_frame_to_chunk(frame_file, i):binary_string = hd_rgb_image_to_binary(frame_file)114 unmodified linesreturn video_pathdef decode_interface(video, output_file):result = decode(video.name, output_file.name)return result# Create Gradio interfacewith gr.Blocks() as demo:15 unmodified linesgr.Markdown("1. Upload the video you want to decode.")gr.Markdown("2. Specify the output file path.")gr.Markdown("3. Click the 'Decode' button.")gr.Markdown("4. View the decoding result.")video_input = gr.File(label="Upload video to decode")output_file_input = gr.File(label="Output file path")decode_button = gr.Button("Decode")decode_output = gr.Textbox(label="Decoding Result")decode_button.click(decode_interface, inputs=[video_input, output_file_input], outputs=decode_output)demo.launch()65 unmodified lines66676869707172114 unmodified lines18718818919019119219319415 unmodified lines21021121221321421521621721821922022122222365 unmodified linesmerge_chunks(chunk_files, output_file_path)# Verify file integrityoriginal_hash = calculate_sha256(output_file_path)return output_file_path, f"SHA-256 hash of the decoded file: {original_hash}"def convert_frame_to_chunk(frame_file, i):binary_string = hd_rgb_image_to_binary(frame_file)114 unmodified linesreturn video_pathdef decode_interface(video, output_file):output_file_path, result = decode(video.name, output_file.name)return output_file_path, result# Create Gradio interfacewith gr.Blocks() as demo:15 unmodified linesgr.Markdown("1. Upload the video you want to decode.")gr.Markdown("2. Specify the output file path.")gr.Markdown("3. Click the 'Decode' button.")gr.Markdown("4. Download the decoded file.")gr.Markdown("5. View the decoding result.")video_input = gr.File(label="Upload video to decode")output_file_input = gr.File(label="Output file path")decode_button = gr.Button("Decode")decode_output = gr.File(label="Decoded File", interactive=True)decode_result = gr.Textbox(label="Decoding Result")decode_button.click(decode_interface, inputs=[video_input, output_file_input], outputs=[decode_output, decode_result])demo.launch()
app.py+8-6