Spaces:
Paused
Paused
WIP
Browse files
app.py
CHANGED
@@ -138,7 +138,13 @@ mf_transcribe = gr.Interface(
|
|
138 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
139 |
" of arbitrary length."
|
140 |
),
|
141 |
-
flagging_mode="manual"
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
)
|
143 |
|
144 |
file_transcribe = gr.Interface(
|
@@ -160,91 +166,18 @@ file_transcribe = gr.Interface(
|
|
160 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
161 |
" of arbitrary length."
|
162 |
),
|
163 |
-
flagging_mode="manual"
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
)
|
165 |
|
166 |
# Then set up the demo with the interfaces
|
167 |
with demo:
|
168 |
-
|
169 |
-
with gr.Row():
|
170 |
-
with gr.Column():
|
171 |
-
# Quick feedback
|
172 |
-
feedback_rating = gr.Radio(
|
173 |
-
choices=["👍 Good", "👎 Bad"],
|
174 |
-
label="Was this transcription accurate?",
|
175 |
-
value="👍 Good"
|
176 |
-
)
|
177 |
-
|
178 |
-
# Detailed feedback
|
179 |
-
with gr.Accordion("Detailed Feedback", open=False):
|
180 |
-
flag_type = gr.Radio(
|
181 |
-
choices=[
|
182 |
-
"Text Issue",
|
183 |
-
"Timestamp Issue",
|
184 |
-
"Missing Content",
|
185 |
-
"Other Issue"
|
186 |
-
],
|
187 |
-
label="What type of issue did you find?",
|
188 |
-
value="Text Issue"
|
189 |
-
)
|
190 |
-
|
191 |
-
# Correction submission
|
192 |
-
with gr.Row():
|
193 |
-
with gr.Column():
|
194 |
-
gr.Markdown("### Original")
|
195 |
-
original_text = gr.Textbox(
|
196 |
-
label="Original text",
|
197 |
-
interactive=False,
|
198 |
-
lines=2
|
199 |
-
)
|
200 |
-
with gr.Column():
|
201 |
-
gr.Markdown("### Correction")
|
202 |
-
corrected_text = gr.Textbox(
|
203 |
-
label="Corrected text",
|
204 |
-
placeholder="Enter the correct text here",
|
205 |
-
lines=2
|
206 |
-
)
|
207 |
-
|
208 |
-
# Timestamp correction
|
209 |
-
with gr.Row():
|
210 |
-
with gr.Column():
|
211 |
-
gr.Markdown("### Original Timestamp")
|
212 |
-
original_timestamp = gr.Textbox(
|
213 |
-
label="Original timestamp",
|
214 |
-
interactive=False,
|
215 |
-
lines=1
|
216 |
-
)
|
217 |
-
with gr.Column():
|
218 |
-
gr.Markdown("### Corrected Timestamp")
|
219 |
-
corrected_timestamp = gr.Textbox(
|
220 |
-
label="Corrected timestamp (HH:MM:SS,mmm)",
|
221 |
-
placeholder="00:00:00,000",
|
222 |
-
lines=1
|
223 |
-
)
|
224 |
-
|
225 |
-
flag_details = gr.Textbox(
|
226 |
-
label="Additional notes",
|
227 |
-
placeholder="Any other details about the issue...",
|
228 |
-
lines=3
|
229 |
-
)
|
230 |
-
|
231 |
-
flag_button = gr.Button("Submit Feedback")
|
232 |
-
|
233 |
-
# Setup flagging callback with all feedback components
|
234 |
-
flagging_callback.setup(
|
235 |
-
[tabs, feedback_rating, flag_type, original_text, corrected_text,
|
236 |
-
original_timestamp, corrected_timestamp, flag_details],
|
237 |
-
"flagged_data"
|
238 |
-
)
|
239 |
-
|
240 |
-
# Handle flag submission
|
241 |
-
flag_button.click(
|
242 |
-
lambda *args: flagging_callback.flag(list(args)),
|
243 |
-
[tabs, feedback_rating, flag_type, original_text, corrected_text,
|
244 |
-
original_timestamp, corrected_timestamp, flag_details],
|
245 |
-
None,
|
246 |
-
preprocess=False
|
247 |
-
)
|
248 |
|
249 |
logger.info("Starting Gradio interface")
|
250 |
demo.queue().launch(ssr_mode=False)
|
|
|
138 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
139 |
" of arbitrary length."
|
140 |
),
|
141 |
+
flagging_mode="manual",
|
142 |
+
flagging_options=[
|
143 |
+
"Text Issue",
|
144 |
+
"Timestamp Issue",
|
145 |
+
"Missing Content",
|
146 |
+
"Other Issue"
|
147 |
+
]
|
148 |
)
|
149 |
|
150 |
file_transcribe = gr.Interface(
|
|
|
166 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
167 |
" of arbitrary length."
|
168 |
),
|
169 |
+
flagging_mode="manual",
|
170 |
+
flagging_options=[
|
171 |
+
"Text Issue",
|
172 |
+
"Timestamp Issue",
|
173 |
+
"Missing Content",
|
174 |
+
"Other Issue"
|
175 |
+
]
|
176 |
)
|
177 |
|
178 |
# Then set up the demo with the interfaces
|
179 |
with demo:
|
180 |
+
gr.TabbedInterface([mf_transcribe, file_transcribe], ["Microphone", "Audio file"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
|
182 |
logger.info("Starting Gradio interface")
|
183 |
demo.queue().launch(ssr_mode=False)
|