Lenylvt commited on
Commit
bab55a1
1 Parent(s): b75069e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import re
3
+
4
+ def remove_timestamps(text):
5
+ # Pattern to match timestamps in the format [HH:MM:SS.mmm -> HH:MM:SS.mmm]
6
+ pattern = r"\[\d{2}:\d{2}:\d{2}\.\d{3} -> \d{2}:\d{2}:\d{2}\.\d{3}\]\s*"
7
+ # Replace the matched patterns with an empty string
8
+ cleaned_text = re.sub(pattern, "", text)
9
+ return cleaned_text
10
+
11
+ iface = gr.Interface(fn=remove_timestamps,
12
+ inputs="text_area",
13
+ outputs="text",
14
+ title="Whisper Remove Timestamps API",
15
+ description="For web use please visit [this space](https://huggingface.co/spaces/Lenylvt/Whisper_Timestamps_Remover)")
16
+
17
+ iface.launch()