Sanj004 commited on
Commit
a2f8966
·
verified ·
1 Parent(s): 7ae75ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -9
app.py CHANGED
@@ -10,13 +10,6 @@ model_name = "facebook/bart-base"
10
  model = AutoModelForSeq2SeqLM.from_pretrained(SAVED_MODEL_PATH).to(device)
11
  tokenizer = AutoTokenizer.from_pretrained(model_name)
12
 
13
- dataset = load_dataset("samsum")
14
- #dataset = load_dataset("samsum", download_mode="force_redownload")
15
-
16
-
17
- train_data = dataset["train"]
18
- validation_data = dataset["validation"]
19
- test_data = dataset["test"]
20
 
21
  def summarize(text):
22
  inputs = tokenizer(f"Summarize dialogue >>\n {text}", return_tensors="pt", max_length=1000, truncation=True, padding="max_length").to(device)
@@ -27,8 +20,8 @@ def summarize(text):
27
 
28
  iface = gr.Interface(
29
  fn=summarize,
30
- inputs=gr.inputs.Textbox(lines=10, label="Input Dialogue"),
31
- outputs=gr.outputs.Textbox(label="Generated Summary")
32
  )
33
 
34
  iface.launch()
 
10
  model = AutoModelForSeq2SeqLM.from_pretrained(SAVED_MODEL_PATH).to(device)
11
  tokenizer = AutoTokenizer.from_pretrained(model_name)
12
 
 
 
 
 
 
 
 
13
 
14
  def summarize(text):
15
  inputs = tokenizer(f"Summarize dialogue >>\n {text}", return_tensors="pt", max_length=1000, truncation=True, padding="max_length").to(device)
 
20
 
21
  iface = gr.Interface(
22
  fn=summarize,
23
+ inputs=gr.Textbox(lines=10, label="Input Dialogue"),
24
+ outputs=gr.Textbox(label="Generated Summary")
25
  )
26
 
27
  iface.launch()