Spaces:
Runtime error
Runtime error
jlazoff
commited on
Commit
•
2e4b54d
1
Parent(s):
da9e19a
init commit
Browse files- README.md +40 -6
- app.py +59 -0
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,12 +1,46 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.15.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
10 |
---
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Pegasus Text Summarizers
|
3 |
+
emoji: 👀
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: gray
|
6 |
sdk: gradio
|
|
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
+
license: apache-2.0
|
10 |
---
|
11 |
|
12 |
+
# Configuration
|
13 |
+
|
14 |
+
`title`: _string_
|
15 |
+
Display title for the Space
|
16 |
+
|
17 |
+
`emoji`: _string_
|
18 |
+
Space emoji (emoji-only character allowed)
|
19 |
+
|
20 |
+
`colorFrom`: _string_
|
21 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
22 |
+
|
23 |
+
`colorTo`: _string_
|
24 |
+
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
|
25 |
+
|
26 |
+
`sdk`: _string_
|
27 |
+
Can be either `gradio`, `streamlit`, or `static`
|
28 |
+
|
29 |
+
`sdk_version` : _string_
|
30 |
+
Only applicable for `streamlit` SDK.
|
31 |
+
See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
|
32 |
+
|
33 |
+
`app_file`: _string_
|
34 |
+
Path to your main application file (which contains either `gradio` or `streamlit` Python code, or `static` html code).
|
35 |
+
Path is relative to the root of the repository.
|
36 |
+
|
37 |
+
`models`: _List[string]_
|
38 |
+
HF model IDs (like "gpt2" or "deepset/roberta-base-squad2") used in the Space.
|
39 |
+
Will be parsed automatically from your code if not specified here.
|
40 |
+
|
41 |
+
`datasets`: _List[string]_
|
42 |
+
HF dataset IDs (like "common_voice" or "oscar-corpus/OSCAR-2109") used in the Space.
|
43 |
+
Will be parsed automatically from your code if not specified here.
|
44 |
+
|
45 |
+
`pinned`: _boolean_
|
46 |
+
Whether the Space stays on top of your list.
|
app.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from transformers import pipeline
|
4 |
+
import gradio as gr
|
5 |
+
from gradio.mix import Parallel, Series
|
6 |
+
|
7 |
+
io1 = gr.Interface.load('huggingface/google/pegasus-large')
|
8 |
+
io2 = gr.Interface.load("huggingface/google/pegasus-cnn_dailymail")
|
9 |
+
io3 = gr.Interface.load("huggingface/google/pegasus-xsum")
|
10 |
+
io4 = gr.Interface.load('huggingface/google/pegasus-newsroom')
|
11 |
+
io5 = gr.Interface.load("huggingface/google/pegasus-multi_news")
|
12 |
+
io6 = gr.Interface.load("huggingface/google/pegasus-reddit_tifu")
|
13 |
+
io7 = gr.Interface.load('huggingface/google/pegasus-arxiv')
|
14 |
+
# io8 = gr.Interface.load("huggingface/google/pegasus-pubmed")
|
15 |
+
# io9 = gr.Interface.load("huggingface/google/pegasus-wikihow")
|
16 |
+
# io10 = gr.Interface.load('huggingface/google/pegasus-gigaword')
|
17 |
+
# io11 = gr.Interface.load("huggingface/google/pegasus-billsum")
|
18 |
+
# io12 = gr.Interface.load("huggingface/google/pegasus-big_patent")
|
19 |
+
# io13 = gr.Interface.load("huggingface/google/pegasus-aeslc")
|
20 |
+
|
21 |
+
desc = "Let Hugging Face models summarize texts for you. Note: Shorter articles generate faster summaries. This summarizer uses pegasus by Google. You can compare these models against each other on their performances."
|
22 |
+
|
23 |
+
x = """ What's A Lawyer Now? Simply put… there is a tremendous manifest and latent need for just about ALL legal services. There are solid interrelated sociological and structural reasons for this including considerable societal divisiveness, meaningful changes in laws and regulations, and fast-paced disruptive technological innovations. At the same time, there are psychological factors that strongly prompt the need for various legal services such as hubris, arrogance, and Machiavellianism. The opportunities, across a wide spectrum of law firm practice areas, have probably never been greater. Although there is a tremendous amount of untapped potential for legal services, there is one major obstacle to opening the spigot – lawyers. From solo practices to mega-international law firms, many lawyers because of their inherent inclinations (e.g., risk aversion) reinforced by their education and firm experience are not going to take advantage of the incredible latent demand for legal services. As commoditization is rampant in the legal profession, the path to success is not just having “excellent knowledge of the law.” Being technical proficient is table stakes. Unfortunately, a large percentage of lawyers equate legal competence with the success of their practice, and the great majority is proven wrong. What is also required of lawyers at all levels, in order to truly excel in today’s legal environment, is a touch of entrepreneurialism coupled with some business savvy. The opportunities for lawyers are most everywhere from inside their own book of business to the clients of other lawyers in their firms to the many other types of professionals they know or can fairly easily get to know. The complication is that when it comes to the business development side of legal work, few lawyers have the expertise to create a steady stream of new work for their practices or their firms. Unless lawyers adopt these best practices, it is unlikely that they will be able to greatly benefit from all the tremendous pent up demand that exists for legal services. Conversely, for those lawyers who take a proactive and systemic approach to business development, their practices could easily grow exponentially.
|
24 |
+
"""
|
25 |
+
|
26 |
+
y = '''What is Text Summarization?
|
27 |
+
Text summarization is an important NLP task, which has several applications. The two broad categories of approaches to text summarization are extraction and abstraction. Extractive methods select a subset of existing words, phrases, or sentences in the original text to form a summary. In contrast, abstractive methods first build an internal semantic representation and then use natural language generation techniques to create a summary. Such a summary might contain words that are not explicitly present in the original document. Most text summarization systems are based on some form of extractive summarization.
|
28 |
+
In general, topic identification, interpretation, summary generation, and evaluation of the generated summary are the key challenges in text summarization. The critical tasks in extraction-based summarization are identifying key phrases in the document and using them to select sentences in the document for inclusion in the summary. In contrast, abstraction-based methods paraphrase sections of the source document.
|
29 |
+
All extraction-based summarizers perform the following three relatively independent tasks (Nenkova and McKeown, 2011, 2012): (a) capturing key aspects of text and storing as an intermediate representation, (b) scoring sentences in the text based on that representation, (c) and composing a summary by selecting several sentences.'''
|
30 |
+
|
31 |
+
z = '''Machine Learning Technology Trends To Impact Business in 2022
|
32 |
+
In this article, we will discuss the latest innovations in machine learning technology in 2021 from our perspective as a machine learning software development company. We’ll go over 9 trends and explain how the latest innovations in machine learning technologies can benefit you and your business in 2022.
|
33 |
+
1. No-Code Machine Learning
|
34 |
+
2. TinyML
|
35 |
+
3. AutoML
|
36 |
+
4. Machine Learning Operationalization Management
|
37 |
+
5. Full-stack Deep Learning
|
38 |
+
6. Generative Adversarial Networks
|
39 |
+
7. Unsupervised ML
|
40 |
+
8. Reinforcement Learning
|
41 |
+
'''
|
42 |
+
|
43 |
+
sample = [[y],[x],[z]]
|
44 |
+
|
45 |
+
iface = Parallel(io1,
|
46 |
+
io2,
|
47 |
+
io3,
|
48 |
+
io4,
|
49 |
+
io5,
|
50 |
+
io6,
|
51 |
+
io7,
|
52 |
+
# io8, io9, io10, io11, io12, io13,
|
53 |
+
theme='huggingface',
|
54 |
+
title= 'Hugging Face Text Summarizer',
|
55 |
+
description = desc,
|
56 |
+
examples=sample, #replace "sample" with directory to let gradio scan through those files and give you the text
|
57 |
+
inputs = gr.inputs.Textbox(lines = 10, label="Text"))
|
58 |
+
|
59 |
+
iface.launch(inline = False)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
torch
|
2 |
+
transformers
|