Lenylvt's picture
Create app.py
bab55a1 verified
raw
history blame contribute delete
679 Bytes
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()