Spaces:
Runtime error
Runtime error
Commit
·
0138957
1
Parent(s):
0478000
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from subtitles import Video_To_Text
|
| 4 |
+
from summary import summary_nlp,Summary_BART
|
| 5 |
+
from translate import Translation
|
| 6 |
+
|
| 7 |
+
def Processing(url,model,lang):
|
| 8 |
+
summary_result=" "
|
| 9 |
+
trans_res=" "
|
| 10 |
+
language=""
|
| 11 |
+
data=Video_To_Text(url)
|
| 12 |
+
if(model=="NLP"):
|
| 13 |
+
summary_result=summary_nlp(data)
|
| 14 |
+
elif(model=="BART"):
|
| 15 |
+
summary_result=Summary_BART(data)
|
| 16 |
+
if(lang=="Urdu"):
|
| 17 |
+
language="urdu"
|
| 18 |
+
elif(lang=="German"):
|
| 19 |
+
language="german"
|
| 20 |
+
elif(lan=="Hindi"):
|
| 21 |
+
language="hindi"
|
| 22 |
+
trans_res=Translation(summary_result,language)
|
| 23 |
+
return summary_result,trans_res
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
interface=gr.Interface(fn=Processing,inputs=[gr.components.Textbox(placeholder="Enter YouTube Video Link",label="YouTube Video Link"),gr.components.Radio(["NLP","BART"],type="value",label="Select any one Summary Model")],gr.components.Radio(["Urdu","German","Hindi"],type="value",label="Select any one Language")],
|
| 27 |
+
outputs=[gr.components.Textbox(label="Summary in English"),gr.outputs.Textbox(label="Summary in English")],
|
| 28 |
+
|
| 29 |
+
interface.launch(debug=True)
|