Kabatubare commited on
Commit
fb7b6ea
1 Parent(s): 9b38565

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -12
app.py CHANGED
@@ -115,18 +115,46 @@ else:
115
  style = ""
116
 
117
  # Define Gradio interface
118
- with gr.Blocks(css=style) as demo:
119
- with gr.Tab("Watermark Audio"):
120
- with gr.Column(scale=6):
121
- audio_input_watermark = gr.Audio(label="Upload Audio File for Watermarking", type="filepath")
122
- unique_message_output = gr.Textbox(label="Unique Message")
123
- watermarked_audio_output = gr.Audio(label="Watermarked Audio")
124
- message_output = gr.Textbox(label="Message Used for Watermarking")
125
- enhanced_id_output = gr.Textbox(label="Enhanced ID")
126
- generate_message_button = gr.Button("Generate Unique Message")
127
- watermark_button = gr.Button("Apply Watermark")
128
- generate_message_button.click(fn=generate_unique_message, inputs=None, outputs=unique_message_output)
129
- watermark_button.click(fn=watermark_audio, inputs=[audio_input_watermark, unique_message_output], outputs=[watermarked_audio_output, message_output, enhanced_id_output])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  with gr.Tab("Detect Watermark"):
132
  with gr.Column(scale=6):
 
115
  style = ""
116
 
117
  # Define Gradio interface
118
+ def gradio_interface():
119
+ with gr.Blocks(css=style) as demo:
120
+ with gr.Tab("Watermark Audio"):
121
+ with gr.Column(scale=6):
122
+ gr.Markdown("""**How to Watermark Your Audio**
123
+ This tool embeds a unique, invisible watermark into your audio files to mark them as yours. Follow these steps:
124
+ 1. **Upload Your Audio**: Choose the audio file you want to watermark.
125
+ 2. **Generate Unique Message**: Click this button to generate a unique code that will serve as your audio's watermark.
126
+ 3. **Apply Watermark**: Embed the watermark into your audio file. This process does not alter the audio's quality.
127
+ 4. **Download Watermarked Audio**: After the watermark is applied, you can download the watermarked audio. It will sound identical to the original but now contains your unique watermark.
128
+ 5. **View Enhanced ID**: Along with the watermarked audio, you'll get an enhanced ID for additional tracking and verification purposes.
129
+ """)
130
+ audio_input_watermark = gr.Audio(label="Upload Audio File for Watermarking", type="filepath")
131
+ unique_message_output = gr.Textbox(label="Unique Message")
132
+ watermarked_audio_output = gr.Audio(label="Watermarked Audio")
133
+ message_output = gr.Textbox(label="Message Used for Watermarking")
134
+ enhanced_id_output = gr.Textbox(label="Enhanced ID")
135
+ generate_message_button = gr.Button("Generate Unique Message")
136
+ watermark_button = gr.Button("Apply Watermark")
137
+ generate_message_button.click(fn=generate_unique_message, inputs=None, outputs=unique_message_output)
138
+ watermark_button.click(fn=watermark_audio, inputs=[audio_input_watermark, unique_message_output], outputs=[watermarked_audio_output, message_output, enhanced_id_output])
139
+
140
+ with gr.Tab("Detect Watermark"):
141
+ with gr.Column(scale=6):
142
+ gr.Markdown("""**How to Detect a Watermark in Your Audio**
143
+ Use this feature to check if an audio file contains a specific watermark. Here's how:
144
+ 1. **Upload the Audio File**: Select the audio file you want to check.
145
+ 2. **Enter Original Hex Message**: If you know the hexadecimal code of the watermark, enter it here for a precise search.
146
+ 3. **Detect Watermark**: Click to analyze the audio for your watermark.
147
+ 4. **Review Results**: Find out whether your watermark was detected and if the detected code matches your input.
148
+ """)
149
+ audio_input_detect_watermark = gr.Audio(label="Upload Audio File for Watermark Detection", type="filepath")
150
+ original_hex_input = gr.Textbox(label="Original Hex Message for Comparison", placeholder="Enter the original hex message here")
151
+ detect_watermark_button = gr.Button("Detect Watermark")
152
+ watermark_detection_output = gr.Textbox(label="Watermark Detection Result")
153
+ detected_message_output = gr.Textbox(label="Detected Hex Message")
154
+ match_result_output = gr.Textbox(label="Match Result")
155
+ detect_watermark_button.click(fn=detect_watermark, inputs=[audio_input_detect_watermark, original_hex_input], outputs=[watermark_detection_output, detected_message_output, match_result_output])
156
+
157
+ return demo enhanced_id_output])
158
 
159
  with gr.Tab("Detect Watermark"):
160
  with gr.Column(scale=6):