Spaces:
Sleeping
Sleeping
File size: 728 Bytes
5a00e55 24572ab ecab5c8 a6eeda1 84929e1 b651447 84929e1 24572ab ecab5c8 e83061d 84929e1 ecab5c8 84929e1 ecab5c8 24572ab a2c48df c4edab0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import torch
import gradio as gr
from transformers import pipeline
# Use a pipeline as a high-level helper
device = 0 if torch.cuda.is_available() else -1
text_summary = pipeline("summarization", model="Falconsai/text_summarization",device=device,torch_dtype=torch.bfloat16)
def summary(input):
output = text_summary(input)
return output[0]['summary_text']
gr.close_all()
# Create the Gradio interface
demo = gr.Interface(
fn=summary,
inputs=[gr.Textbox(label="INPUT THE PASSAGE TO SUMMARIZE ", lines=10)],
outputs=[gr.Textbox(label="SUMMARIZED TEXT", lines=4)],
title="PAVISHINI @ GenAI Project 1: Text Summarizer",
description="This application is used to summarize the text"
)
demo.launch()
|