Update app.py
Browse files
app.py
CHANGED
@@ -52,9 +52,10 @@ def summarize(video_id):
|
|
52 |
|
53 |
texts = preprocessing(transcript)
|
54 |
inputs = tokenizer(texts, return_tensors="pt", padding=True, )
|
|
|
55 |
|
56 |
with torch.no_grad():
|
57 |
-
output_tokens = model.generate(
|
58 |
outputs = tokenizer.batch_decode(output_tokens.detach().cpu().numpy(), skip_special_tokens=True)
|
59 |
|
60 |
return outputs
|
@@ -65,4 +66,4 @@ gr.Interface(
|
|
65 |
# inputs = gr.File(file_types=["text"], label="Upload a text file.", interactive=True),
|
66 |
inputs = gr.Textbox(label="Video_ID", interactive=True),
|
67 |
outputs = gr.Textbox(label="Summary", max_lines=120, interactive=False),
|
68 |
-
).launch(debug=True)
|
|
|
52 |
|
53 |
texts = preprocessing(transcript)
|
54 |
inputs = tokenizer(texts, return_tensors="pt", padding=True, )
|
55 |
+
inputs = inputs["input_ids"].to(device)
|
56 |
|
57 |
with torch.no_grad():
|
58 |
+
output_tokens = model.generate(*inputs, max_new_tokens=60, do_sample=True, top_p=0.9)
|
59 |
outputs = tokenizer.batch_decode(output_tokens.detach().cpu().numpy(), skip_special_tokens=True)
|
60 |
|
61 |
return outputs
|
|
|
66 |
# inputs = gr.File(file_types=["text"], label="Upload a text file.", interactive=True),
|
67 |
inputs = gr.Textbox(label="Video_ID", interactive=True),
|
68 |
outputs = gr.Textbox(label="Summary", max_lines=120, interactive=False),
|
69 |
+
).launch(debug=True)
|