Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import
|
|
|
|
| 3 |
|
| 4 |
-
API_URL = "https://edensw-vid2sum.hf.space/run/predict"
|
| 5 |
|
| 6 |
def Vid2Sum(vid_file):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
iface = gr.Interface(fn=Vid2Sum, inputs="video", outputs="text")
|
| 13 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from API import aud2text, Summarize
|
| 3 |
+
from moviepy.editor import *
|
| 4 |
|
|
|
|
| 5 |
|
| 6 |
def Vid2Sum(vid_file):
|
| 7 |
+
video = VideoFileClip(vid_file)
|
| 8 |
+
audio_file = "converted_audio.mp3"
|
| 9 |
+
video.audio.write_audiofile(audio_file)
|
| 10 |
+
|
| 11 |
+
text = aud2text(audio_file)
|
| 12 |
+
sum_text=Summarize(text["text"])
|
| 13 |
+
return sum_text
|
| 14 |
+
|
| 15 |
+
# return sum_text[0]["summary_text"]
|
| 16 |
|
| 17 |
iface = gr.Interface(fn=Vid2Sum, inputs="video", outputs="text")
|
| 18 |
iface.launch()
|