Spaces:
Sleeping
Sleeping
Commit
•
f91d5ee
1
Parent(s):
a8924ed
Commit Test SRT
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
# Function to extract text from SRT-formatted text
|
5 |
def extract_text_from_srt_text(srt_text):
|
6 |
-
lines = srt_text.strip().split("\n")
|
7 |
-
texts = [
|
8 |
return " ".join(texts)
|
9 |
|
10 |
# Load summarization pipeline
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Function to extract text from SRT-formatted text
|
5 |
# Function to extract text from SRT-formatted text
|
6 |
def extract_text_from_srt_text(srt_text):
|
7 |
+
lines = srt_text.strip().split("\n\n") # Split by empty lines to separate subtitles
|
8 |
+
texts = [subtitle.split("\n")[2] for subtitle in lines if subtitle.strip()] # Extract text from the third line of each subtitle
|
9 |
return " ".join(texts)
|
10 |
|
11 |
# Load summarization pipeline
|