Spaces:
Runtime error
Runtime error
Update app.py
Browse filesfrontend modification...
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import streamlit as st
|
|
| 6 |
import numpy as np
|
| 7 |
from fpdf import FPDF
|
| 8 |
from reportlab.pdfgen.canvas import Canvas
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
|
|
@@ -48,7 +49,7 @@ def predict(url=None, translation="No",tran_lang="en"):
|
|
| 48 |
else:
|
| 49 |
return lang_dict, transcription
|
| 50 |
|
| 51 |
-
url = st.text_input(
|
| 52 |
tran_req = st.selectbox(label="Do you want to translate the transcript?",options=("Yes","No"))
|
| 53 |
|
| 54 |
if tran_req=="Yes":
|
|
@@ -57,13 +58,21 @@ else:
|
|
| 57 |
lang = "en"
|
| 58 |
|
| 59 |
if st.button("Generate"):
|
|
|
|
| 60 |
lang_d,transcription,trans = predict(url,translation=tran_req,tran_lang=lang)
|
| 61 |
-
|
| 62 |
-
st.
|
|
|
|
|
|
|
|
|
|
| 63 |
#canvas = Canvas("transcript.pdf")
|
| 64 |
#canvas.drawString(72, 72, transcription)
|
| 65 |
#canvas.save()
|
| 66 |
#st.download_button(label="Click here to download the transcript", data=canvas, mime='text/csv',file_name="transcript.pdf")
|
| 67 |
st.write(transcription)
|
|
|
|
|
|
|
| 68 |
st.write("Translation: ")
|
| 69 |
-
|
|
|
|
|
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
from fpdf import FPDF
|
| 8 |
from reportlab.pdfgen.canvas import Canvas
|
| 9 |
+
import time
|
| 10 |
|
| 11 |
|
| 12 |
|
|
|
|
| 49 |
else:
|
| 50 |
return lang_dict, transcription
|
| 51 |
|
| 52 |
+
url = st.text_input(label="Please enter the YouTube url: ")
|
| 53 |
tran_req = st.selectbox(label="Do you want to translate the transcript?",options=("Yes","No"))
|
| 54 |
|
| 55 |
if tran_req=="Yes":
|
|
|
|
| 58 |
lang = "en"
|
| 59 |
|
| 60 |
if st.button("Generate"):
|
| 61 |
+
st.progress(value=0, text="Fetching the video...")
|
| 62 |
lang_d,transcription,trans = predict(url,translation=tran_req,tran_lang=lang)
|
| 63 |
+
|
| 64 |
+
st.progress(value=50,text="Speech to Text engine running...")
|
| 65 |
+
time.sleep(1)
|
| 66 |
+
|
| 67 |
+
st.write("Detected language:",lang_d)
|
| 68 |
#canvas = Canvas("transcript.pdf")
|
| 69 |
#canvas.drawString(72, 72, transcription)
|
| 70 |
#canvas.save()
|
| 71 |
#st.download_button(label="Click here to download the transcript", data=canvas, mime='text/csv',file_name="transcript.pdf")
|
| 72 |
st.write(transcription)
|
| 73 |
+
st.progress(value=75,text="Translation in progress..")
|
| 74 |
+
time.sleep(1)
|
| 75 |
st.write("Translation: ")
|
| 76 |
+
|
| 77 |
+
st.write(trans)
|
| 78 |
+
st.sucess("Speech to text converted successfully!")
|