File size: 679 Bytes
bab55a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import re

def remove_timestamps(text):
    # Pattern to match timestamps in the format [HH:MM:SS.mmm -> HH:MM:SS.mmm]
    pattern = r"\[\d{2}:\d{2}:\d{2}\.\d{3} -> \d{2}:\d{2}:\d{2}\.\d{3}\]\s*"
    # Replace the matched patterns with an empty string
    cleaned_text = re.sub(pattern, "", text)
    return cleaned_text

iface = gr.Interface(fn=remove_timestamps,
                     inputs="text_area",
                     outputs="text",
                     title="Whisper Remove Timestamps API",
                     description="For web use please visit [this space](https://huggingface.co/spaces/Lenylvt/Whisper_Timestamps_Remover)")

iface.launch()