Spaces:
Runtime error
Runtime error
File size: 7,004 Bytes
2e4b54d 8ad5395 db02bb4 51844b5 08d6e4b 51844b5 8ad5395 6a4b723 51844b5 6a4b723 4234b89 8ad5395 08d6e4b 51844b5 6ce5d7d 2e4b54d 6ce5d7d 8ad5395 63b1ed4 51844b5 08d6e4b 51844b5 8ad5395 6a4b723 51844b5 6a4b723 4234b89 8ad5395 08d6e4b 51844b5 6ce5d7d 32b1136 6ce5d7d 51844b5 6ce5d7d 9f052af |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
import gradio as gr
from transformers import pipeline
import gradio as gr
from gradio.mix import Parallel, Series
io1 = gr.Interface.load('huggingface/google/pegasus-large')
io2 = gr.Interface.load("huggingface/google/pegasus-cnn_dailymail")
io3 = gr.Interface.load("huggingface/google/pegasus-xsum")
io4 = gr.Interface.load('huggingface/google/pegasus-newsroom')
io5 = gr.Interface.load("huggingface/google/pegasus-multi_news")
#io6 = gr.Interface.load("huggingface/google/pegasus-reddit_tifu")
#io7 = gr.Interface.load('huggingface/google/pegasus-arxiv')
#io8 = gr.Interface.load("huggingface/google/pegasus-pubmed")
#io9 = gr.Interface.load("huggingface/google/pegasus-wikihow")
#io10 = gr.Interface.load('huggingface/google/pegasus-gigaword')
#io11 = gr.Interface.load("huggingface/google/pegasus-billsum")
#io12 = gr.Interface.load("huggingface/google/pegasus-big_patent")
#io13 = gr.Interface.load("huggingface/google/pegasus-aeslc")
#io14 = gr.Interface.load("huggingface/google/pegasus-large")
#io15 = gr.Interface.load("huggingface/google/pegasus-pubmed")
#io16 = gr.Interface.load("huggingface/google/bigbird-pegasus-large-arxiv")
#io17 = gr.Interface.load("huggingface/sshleifer/distill-pegasus-xsum-16-4")
#io18 = gr.Interface.load("huggingface/sshleifer/distill-pegasus-cnn-16-4")
#io19 = gr.Interface.load("huggingface/tuner007/pegasus_summarizer")
#io20 = gr.Interface.load("huggingface/pszemraj/pegasus-x-large-book-summary")
#io21 = gr.Interface.load("huggingface/google/pegasus-x-large")
#io22 = gr.Interface.load("huggingface/google/pegasus-x-base")
#io23 = gr.Interface.load("huggingface/xysmalobia/pegasus-samsum")
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."
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.
"""
y = '''What is Text Summarization?
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.
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.
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.'''
z = '''Machine Learning Technology Trends To Impact Business in 2022
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.
1. No-Code Machine Learning
2. TinyML
3. AutoML
4. Machine Learning Operationalization Management
5. Full-stack Deep Learning
6. Generative Adversarial Networks
7. Unsupervised ML
8. Reinforcement Learning
'''
sample = [[y], [x], [z]]
iface = Parallel(io1,
io2,
io3,
io4,
io5,
#io6,
#io7,
#io8,
#io9,
#io10,
#io11,
#io12,
#io13,
#io14,
#io15,
#io16,
#io17,
#io18,
#io19,
#io20,
##io21,
#io22,
#io23,
theme='huggingface',
title='Biblical Text Summarizer',
description=desc,
examples=sample, # replace "sample" with directory to let gradio scan through those files and give you the text
inputs=gr.inputs.Textbox(lines=30, label="Text"))
iface.launch(inline=False) |