Update app.py
Browse files
app.py
CHANGED
|
@@ -66,7 +66,7 @@ def decode(video_path, output_file_path):
|
|
| 66 |
merge_chunks(chunk_files, output_file_path)
|
| 67 |
# Verify file integrity
|
| 68 |
original_hash = calculate_sha256(output_file_path)
|
| 69 |
-
return f"SHA-256 hash of the decoded file: {original_hash}"
|
| 70 |
|
| 71 |
def convert_frame_to_chunk(frame_file, i):
|
| 72 |
binary_string = hd_rgb_image_to_binary(frame_file)
|
|
@@ -187,8 +187,8 @@ def encode_interface(file):
|
|
| 187 |
return video_path
|
| 188 |
|
| 189 |
def decode_interface(video, output_file):
|
| 190 |
-
result = decode(video.name, output_file.name)
|
| 191 |
-
return result
|
| 192 |
|
| 193 |
# Create Gradio interface
|
| 194 |
with gr.Blocks() as demo:
|
|
@@ -210,12 +210,14 @@ with gr.Blocks() as demo:
|
|
| 210 |
gr.Markdown("1. Upload the video you want to decode.")
|
| 211 |
gr.Markdown("2. Specify the output file path.")
|
| 212 |
gr.Markdown("3. Click the 'Decode' button.")
|
| 213 |
-
gr.Markdown("4.
|
|
|
|
| 214 |
|
| 215 |
video_input = gr.File(label="Upload video to decode")
|
| 216 |
output_file_input = gr.File(label="Output file path")
|
| 217 |
decode_button = gr.Button("Decode")
|
| 218 |
-
decode_output = gr.
|
| 219 |
-
|
|
|
|
| 220 |
|
| 221 |
demo.launch()
|
|
|
|
| 66 |
merge_chunks(chunk_files, output_file_path)
|
| 67 |
# Verify file integrity
|
| 68 |
original_hash = calculate_sha256(output_file_path)
|
| 69 |
+
return output_file_path, f"SHA-256 hash of the decoded file: {original_hash}"
|
| 70 |
|
| 71 |
def convert_frame_to_chunk(frame_file, i):
|
| 72 |
binary_string = hd_rgb_image_to_binary(frame_file)
|
|
|
|
| 187 |
return video_path
|
| 188 |
|
| 189 |
def decode_interface(video, output_file):
|
| 190 |
+
output_file_path, result = decode(video.name, output_file.name)
|
| 191 |
+
return output_file_path, result
|
| 192 |
|
| 193 |
# Create Gradio interface
|
| 194 |
with gr.Blocks() as demo:
|
|
|
|
| 210 |
gr.Markdown("1. Upload the video you want to decode.")
|
| 211 |
gr.Markdown("2. Specify the output file path.")
|
| 212 |
gr.Markdown("3. Click the 'Decode' button.")
|
| 213 |
+
gr.Markdown("4. Download the decoded file.")
|
| 214 |
+
gr.Markdown("5. View the decoding result.")
|
| 215 |
|
| 216 |
video_input = gr.File(label="Upload video to decode")
|
| 217 |
output_file_input = gr.File(label="Output file path")
|
| 218 |
decode_button = gr.Button("Decode")
|
| 219 |
+
decode_output = gr.File(label="Decoded File", interactive=True)
|
| 220 |
+
decode_result = gr.Textbox(label="Decoding Result")
|
| 221 |
+
decode_button.click(decode_interface, inputs=[video_input, output_file_input], outputs=[decode_output, decode_result])
|
| 222 |
|
| 223 |
demo.launch()
|