37Rohan commited on
Commit
23c44f3
1 Parent(s): 29793a5

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """app
3
+
4
+ Automatically generated by Colaboratory.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/102X117iwYLnyujM4T3HnbSWZNcWRl3On
8
+ """
9
+
10
+ # For installing packages to use
11
+ #pip install gradio
12
+ #pip install transformers
13
+
14
+ """1. GRADIO is very handy and easy to make GUIs<br>
15
+ 2. Transformers provides APIs to easily download and train state-of-the-art pretrained models.
16
+ """
17
+
18
+ import gradio as gr
19
+ from transformers import pipeline
20
+
21
+ from gradio.outputs import Label
22
+ Name = "Summarizer" #Name of the model i've choose as Summarizer
23
+ about = "Please drop an article or any phrase you want to summarize" # Description about model
24
+ sample = [
25
+ """
26
+ The craze for Cricket in India is huge, and we consider cricketers as our role models. Many cricket fans in India spend hours in front of the television to watch a cricket match. Cricket matches in India are like grand feasts to the eyes and mind. Indians cannot separate themselves from Cricket.
27
+
28
+ Cricket is a fantastic sport that required the use of a bat and ball. Cricket is played between two teams, and each team has 11 players. The major aim of Cricket is to score the highest number of runs. Cricket is played on a pitch in a field. Cricket does not have only one format, but various ones and each format have its own set of rules and duration.
29
+
30
+ There are majorly three formats of Cricket that are played at the international level. Test matches are played for five days, One-Day Internationals are a one day match and Twenty20 Internationals. These matches are played under the strict rules and regulations approved by the International Cricket Council.
31
+ """
32
+ ] # A sample example is provided for using model
33
+
34
+ model = gr.Interface.load("huggingface/facebook/bart-large-cnn") # gr.Interface.load is used for calling repo with the specifying the path
35
+
36
+ UI = gr.Interface(fn=model,inputs=gr.inputs.Textbox(lines=10,placeholder="Write your Summary text....",label="Text"),outputs="text",title=Name,description=about,examples=sample)
37
+ # Interface() is used for constructing GUI
38
+ # for making a textbox we use inputs.Textbox
39
+ UI.launch() #.launch() is for launching interface
40
+