Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,11 @@ import gradio as gr
|
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def summary (input):
|
| 12 |
output = text_summary(input)
|
|
@@ -40,16 +44,16 @@ def get_youtube_transcript(video_url):
|
|
| 40 |
return f"An error occurred: {e}"
|
| 41 |
|
| 42 |
|
| 43 |
-
|
| 44 |
# video_url = "https://youtu.be/5PibknhIsTc"
|
| 45 |
# print(get_youtube_transcript(video_url))
|
| 46 |
|
| 47 |
gr.close_all()
|
| 48 |
|
| 49 |
-
#
|
| 50 |
demo = gr.Interface(fn=get_youtube_transcript,
|
| 51 |
inputs=[gr.Textbox(label="Input YouTube Url to summarize",lines=1)],
|
| 52 |
outputs=[gr.Textbox(label="Summarized text",lines=4)],
|
| 53 |
-
title="YouTube Script Summarizer",
|
| 54 |
description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE YOUTUBE VIDEO SCRIPT.")
|
| 55 |
demo.launch()
|
|
|
|
| 6 |
from transformers import pipeline
|
| 7 |
|
| 8 |
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
|
| 9 |
+
|
| 10 |
+
# model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
|
| 11 |
+
# "/a4f8f3ea906ed274767e9906dbaede7531d660ff")
|
| 12 |
+
# text_summary = pipeline("summarization", model=model_path,
|
| 13 |
+
# torch_dtype=torch.bfloat16)
|
| 14 |
|
| 15 |
def summary (input):
|
| 16 |
output = text_summary(input)
|
|
|
|
| 44 |
return f"An error occurred: {e}"
|
| 45 |
|
| 46 |
|
| 47 |
+
# Example URL (Replace this with the actual URL when using the script)
|
| 48 |
# video_url = "https://youtu.be/5PibknhIsTc"
|
| 49 |
# print(get_youtube_transcript(video_url))
|
| 50 |
|
| 51 |
gr.close_all()
|
| 52 |
|
| 53 |
+
# demo = gr.Interface(fn=summary, inputs="text",outputs="text")
|
| 54 |
demo = gr.Interface(fn=get_youtube_transcript,
|
| 55 |
inputs=[gr.Textbox(label="Input YouTube Url to summarize",lines=1)],
|
| 56 |
outputs=[gr.Textbox(label="Summarized text",lines=4)],
|
| 57 |
+
title="@GenAILearniverse Project 2: YouTube Script Summarizer",
|
| 58 |
description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE YOUTUBE VIDEO SCRIPT.")
|
| 59 |
demo.launch()
|