Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ model = WhisperModel("ivrit-ai/faster-whisper-v2-d4")
|
|
11 |
# ืืืืจืช pipeline ืืกืืืื
|
12 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
13 |
|
14 |
-
def
|
15 |
try:
|
16 |
# ืืืืงื ืื ืืงืืืฅ ืืื ืืืืื ืืืืจืช ืืืืื ืืืืืื ืืืืืช ืืฆืืจื
|
17 |
if file_path.endswith((".mp4", ".mov", ".avi", ".mkv")):
|
@@ -30,10 +30,10 @@ def summarize_audio_or_video(file_path):
|
|
30 |
if audio_file != file_path:
|
31 |
os.remove(audio_file)
|
32 |
|
33 |
-
return summary
|
34 |
|
35 |
except Exception as e:
|
36 |
-
return f"ืฉืืืื ืืขืืืื ืืงืืืฅ: {str(e)}"
|
37 |
|
38 |
def convert_video_to_audio(video_file):
|
39 |
# ืืฆืืจืช ืงืืืฅ ืืืืื ืืื ื
|
@@ -44,11 +44,11 @@ def convert_video_to_audio(video_file):
|
|
44 |
|
45 |
# ืืืืจืช ืืืฉืง Gradio
|
46 |
interface = gr.Interface(
|
47 |
-
fn=
|
48 |
inputs=gr.Audio(type="filepath"),
|
49 |
-
outputs="text",
|
50 |
-
title="ืืืืจ ืืืืื/ืืืืื
|
51 |
-
description="ืืขืื ืงืืืฅ ืืืืื ืื ืืืืื ืฉื ืืจืฆื ืืงืื
|
52 |
)
|
53 |
|
54 |
if __name__ == "__main__":
|
|
|
11 |
# ืืืืจืช pipeline ืืกืืืื
|
12 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
13 |
|
14 |
+
def transcribe_and_summarize(file_path):
|
15 |
try:
|
16 |
# ืืืืงื ืื ืืงืืืฅ ืืื ืืืืื ืืืืจืช ืืืืื ืืืืืื ืืืืืช ืืฆืืจื
|
17 |
if file_path.endswith((".mp4", ".mov", ".avi", ".mkv")):
|
|
|
30 |
if audio_file != file_path:
|
31 |
os.remove(audio_file)
|
32 |
|
33 |
+
return transcript, summary
|
34 |
|
35 |
except Exception as e:
|
36 |
+
return f"ืฉืืืื ืืขืืืื ืืงืืืฅ: {str(e)}", ""
|
37 |
|
38 |
def convert_video_to_audio(video_file):
|
39 |
# ืืฆืืจืช ืงืืืฅ ืืืืื ืืื ื
|
|
|
44 |
|
45 |
# ืืืืจืช ืืืฉืง Gradio
|
46 |
interface = gr.Interface(
|
47 |
+
fn=transcribe_and_summarize,
|
48 |
inputs=gr.Audio(type="filepath"),
|
49 |
+
outputs=["text", "text"], # ืคืื ืืคืื: ืชืืืื ืืกืืืื
|
50 |
+
title="ืืืืจ ืืืืื/ืืืืื ืืชืืืื ืืกืืืื",
|
51 |
+
description="ืืขืื ืงืืืฅ ืืืืื ืื ืืืืื ืฉื ืืจืฆื ืืงืื ืชืืืื ืืื ืืกืืืื ืงืฆืจ ืฉื ืืชืืื."
|
52 |
)
|
53 |
|
54 |
if __name__ == "__main__":
|