cygon24 commited on
Commit
82482f5
·
verified ·
1 Parent(s): a7f76c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -29
app.py CHANGED
@@ -1,29 +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
- # its its used for local after installing the model
7
-
8
-
9
- # model_path = "../models/models--sshleifer--distilbart-cnn-12-6/snapshots/a4f8f3ea906ed274767e9906dbaede7531d660ff"
10
- text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6",torch_dtype=torch.bfloat16)
11
- # text = '''Elon Reeve Musk (/ˈiːlɒn/ EE-lon; born June 28, 1971) is a businessman known for his key roles in Tesla, SpaceX, PayPal, OpenAI, Twitter (which he rebranded as X) and America PAC. Since 2025, he has been a senior advisor to United States president Donald Trump and the de facto head of the Department of Government Efficiency (DOGE). Musk is the wealthiest person in the world; as of March 2025, Forbes estimates his net worth to be US$345 billion. '''
12
- # print(text_summary(text));
13
-
14
- def summary (input):
15
- output = text_summary(input)
16
- return output[0]['summary_text']
17
-
18
- gr.close_all()
19
-
20
- # demo = gr.Interface(fn=summary, inputs="text", outputs="text")
21
-
22
- demo = gr.Interface(
23
- fn=summary,
24
- inputs=[gr.Textbox(label="Input text to summarize", lines=7)],
25
- outputs=[gr.Textbox(label="Summarized text", lines=4)],
26
- title="@cygon: Text summarizer",
27
- description="SIMPLE UNPAID APPLICATION FOR TEXT SUMMARIZING"
28
- )
29
- demo.launch()