Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,23 +30,23 @@ def main():
|
|
| 30 |
|
| 31 |
if captions and translated_captions:
|
| 32 |
captions_list = []
|
| 33 |
-
|
| 34 |
for line in captions.split("\n"):
|
| 35 |
if line.strip():
|
| 36 |
timestamp, text = line.split(" ", 1)
|
| 37 |
-
captions_list.append({"
|
| 38 |
|
| 39 |
for line in translated_captions.split("\n"):
|
| 40 |
if line.strip():
|
| 41 |
timestamp, text = line.split(" ", 1)
|
| 42 |
-
|
| 43 |
|
| 44 |
df = pd.DataFrame(captions_list)
|
| 45 |
-
df['Translated
|
| 46 |
-
df['Translated'] =
|
| 47 |
|
| 48 |
st.write("## Caption Table")
|
| 49 |
-
st.write(df)
|
| 50 |
|
| 51 |
else:
|
| 52 |
st.write("Provided URL did not contain captions or translations")
|
|
|
|
| 30 |
|
| 31 |
if captions and translated_captions:
|
| 32 |
captions_list = []
|
| 33 |
+
translated_list = []
|
| 34 |
for line in captions.split("\n"):
|
| 35 |
if line.strip():
|
| 36 |
timestamp, text = line.split(" ", 1)
|
| 37 |
+
captions_list.append({"Timestamp": timestamp, "Original": text})
|
| 38 |
|
| 39 |
for line in translated_captions.split("\n"):
|
| 40 |
if line.strip():
|
| 41 |
timestamp, text = line.split(" ", 1)
|
| 42 |
+
translated_list.append(text)
|
| 43 |
|
| 44 |
df = pd.DataFrame(captions_list)
|
| 45 |
+
df['Translated'] = translated_list
|
| 46 |
+
df['Translated Timestamp'] = df['Timestamp'] # Assuming the timestamps align
|
| 47 |
|
| 48 |
st.write("## Caption Table")
|
| 49 |
+
st.write(df[['Timestamp', 'Original', 'Translated Timestamp', 'Translated']])
|
| 50 |
|
| 51 |
else:
|
| 52 |
st.write("Provided URL did not contain captions or translations")
|