VishnuPottabatthini commited on
Commit
269ee13
·
verified ·
1 Parent(s): 902bbe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import torch
2
  import gradio as gr
3
- from transformers import BartTokenizer, BartForConditionalGeneration
4
 
5
- # Define the BART model and tokenizer
6
- MODEL_NAME = 'VishnuPottabatthini/BART_demo' # Change this to the model you want to use
7
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
8
 
9
  # Load the tokenizer and model
10
- tokenizer = BartTokenizer.from_pretrained(MODEL_NAME)
11
- model = BartForConditionalGeneration.from_pretrained(MODEL_NAME).to(device)
12
 
13
  # Define the summarization function
14
  def summarize(text, state):
@@ -53,7 +53,7 @@ mf_summarize = gr.Interface(
53
  title="Article Summarization",
54
  live=True,
55
  description=(
56
- "Enter a long piece of text to generate a concise summary using a BART model. "
57
  "This demo uses a custom PEGASUS model from 🤗 Transformers."
58
  )
59
  )
 
1
  import torch
2
  import gradio as gr
3
+ from transformers import PegasusTokenizer, PegasusForConditionalGeneration
4
 
5
+ # Define the PEGASUS model and tokenizer
6
+ MODEL_NAME = 'VishnuPottabatthini/PEGASUS_Large' # Change this to the PEGASUS model
7
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
8
 
9
  # Load the tokenizer and model
10
+ tokenizer = PegasusTokenizer.from_pretrained(MODEL_NAME)
11
+ model = PegasusForConditionalGeneration.from_pretrained(MODEL_NAME).to(device)
12
 
13
  # Define the summarization function
14
  def summarize(text, state):
 
53
  title="Article Summarization",
54
  live=True,
55
  description=(
56
+ "Enter a long piece of text to generate a concise summary using a PEGASUS model. "
57
  "This demo uses a custom PEGASUS model from 🤗 Transformers."
58
  )
59
  )