Delete app.py
Browse files
app.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
# Use a pipeline as a high-level helper
|
| 5 |
-
from transformers import pipeline
|
| 6 |
-
|
| 7 |
-
model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
|
| 8 |
-
"/a4f8f3ea906ed274767e9906dbaede7531d660ff")
|
| 9 |
-
text_summary = pipeline("summarization", model=model_path,
|
| 10 |
-
torch_dtype=torch.bfloat16)
|
| 11 |
-
|
| 12 |
-
# text='''Elon Reeve Musk (/ˈiːlɒn/ EE-lon; born June 28, 1971) is a businessman and investor.
|
| 13 |
-
# He is the founder, chairman, CEO, and CTO of SpaceX; angel investor, CEO, product architect,
|
| 14 |
-
# and former chairman of Tesla, Inc.; owner, executive chairman, and CTO of X Corp.;
|
| 15 |
-
# founder of the Boring Company and xAI; co-founder of Neuralink and OpenAI; and president
|
| 16 |
-
# of the Musk Foundation. He is one of the wealthiest people in the world; as of April 2024,
|
| 17 |
-
# Forbes estimates his net worth to be $178 billion.[4]'''
|
| 18 |
-
# print(text_summary(text));
|
| 19 |
-
|
| 20 |
-
def summary (input):
|
| 21 |
-
output = text_summary(input)
|
| 22 |
-
return output[0]['summary_text']
|
| 23 |
-
|
| 24 |
-
gr.close_all()
|
| 25 |
-
|
| 26 |
-
# demo = gr.Interface(fn=summary, inputs="text",outputs="text")
|
| 27 |
-
demo = gr.Interface(fn=summary,
|
| 28 |
-
inputs=[gr.Textbox(label="Input text to summarize",lines=6)],
|
| 29 |
-
outputs=[gr.Textbox(label="Summarized text",lines=4)],
|
| 30 |
-
title="@GenAILearniverse Project 1: Text Summarizer",
|
| 31 |
-
description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
|
| 32 |
-
demo.launch()
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|