Spaces:
Build error
Build error
File size: 1,363 Bytes
45a123d |
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 torch
import gradio as gr
# Use a pipeline as a high-level helper
from transformers import pipeline
# model_path = "../models/models--sshleifer--distilbart-cnn-12-6/snapshots/a4f8f3ea906ed274767e9906dbaede7531d660ff"
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
# text="Elon Reeve Musk (/ˈiːlɒn mʌsk/; born June 28, 1971) is a businessman known for his key roles in the space company SpaceX and the automotive company Tesla, Inc. He is also known for his ownership of X Corp. (the company that operates the social media platform X, formerly Twitter), and his role in the founding of the Boring Company, xAI, Neuralink, and OpenAI. Musk is the wealthiest individual in the world; as of December 2024, Forbes estimates his net worth to be US$430 billion.[2]"
# print(text_summary(text))
def summary(input):
output = text_summary(input)
return output[0]['summary_text']
gr.close_all()
# demo = gr.Interface(fn=summary, inputs="text", outputs="text")
demo = gr.Interface(fn=summary, inputs=[gr.Textbox(label="Input text to summarize", lines=6)],
outputs=[gr.Textbox(label="Summarized text",lines=4)],
title="GenAI Project 1: Text Summarizer",
description="This application is use to summarized the text")
demo.launch() |