Sayiqa7 commited on
Commit
3d331ca
·
verified ·
1 Parent(s): d9e3ffc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -2
app.py CHANGED
@@ -36,12 +36,38 @@ if hf_token:
36
  else:
37
  raise ValueError("HF_TOKEN environment variable not set.")
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
40
  import gradio as gr
41
 
42
  # Load the model and tokenizer
43
- tokenizer = AutoTokenizer.from_pretrained("machinelearningzuu/youtube-content-summarization")
44
- model = AutoModelForSeq2SeqLM.from_pretrained("machinelearningzuu/youtube-content-summarization")
45
 
46
  # Define a function for summarization
47
  def summarize_youtube_content(input_text):
 
36
  else:
37
  raise ValueError("HF_TOKEN environment variable not set.")
38
 
39
+ # from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
40
+ # import gradio as gr
41
+
42
+ # # Load the model and tokenizer
43
+ # tokenizer = AutoTokenizer.from_pretrained("machinelearningzuu/youtube-content-summarization")
44
+ # model = AutoModelForSeq2SeqLM.from_pretrained("machinelearningzuu/youtube-content-summarization")
45
+
46
+ # # Define a function for summarization
47
+ # def summarize_youtube_content(input_text):
48
+ # # Use the pipeline for summarization
49
+ # summarizer = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
50
+ # summary = summarizer(input_text, max_length=150, min_length=30, do_sample=False)
51
+ # return summary[0]['generated_text']
52
+
53
+ # # Create a Gradio interface
54
+ # interface = gr.Interface(
55
+ # fn=summarize_youtube_content,
56
+ # inputs=gr.Textbox(lines=10, placeholder="Paste YouTube transcript here..."),
57
+ # outputs=gr.Textbox(lines=5, label="Summarized Content"),
58
+ # title="YouTube Content Summarizer",
59
+ # description="Paste the transcript of a YouTube video to generate a concise summary.",
60
+ # )
61
+
62
+ # # Launch the Gradio app
63
+ # if __name__ == "__main__":
64
+ # interface.launch()
65
  from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
66
  import gradio as gr
67
 
68
  # Load the model and tokenizer
69
+ tokenizer = AutoTokenizer.from_pretrained("machinelearningzuu/youtube-content-summarization-bart")
70
+ model = AutoModelForSeq2SeqLM.from_pretrained("machinelearningzuu/youtube-content-summarization-bart")
71
 
72
  # Define a function for summarization
73
  def summarize_youtube_content(input_text):