Spaces:
Sleeping
Sleeping
File size: 1,469 Bytes
e0218d0 cbbfdce ef5d679 21b05f2 2a0f339 cbbfdce 2a0f339 cbbfdce 2a0f339 cbbfdce 2a0f339 cbbfdce 2a0f339 |
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 |
import PyTorch
import gradio as gr
from transformers import pipeline
from transformers import T5ForConditionalGeneration, T5Tokenizer
model_path='Sibinraj/T5-finetuned-dialogue_sumxx'
model = T5ForConditionalGeneration.from_pretrained(model_path)
tokenizer = T5Tokenizer.from_pretrained(model)
summarizer=pipeline('summarization', model=model, tokenizer=tokenizer)
def summarize(text):
summary=summarizer(text, max_length=512, min_length=30,do_sample=False)
return summary[0]['summary']
interface=gr.Interfac(
fn=summarize,
input=fr.inputs.Textbox(lines=10, label="Input text"),
ouputs=gr.outputs.Textbox(label='summarized Text'),
examples=[['The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.']])
if __name__=='__main__':
interface.launch() |