File size: 1,074 Bytes
a8bf144
1244cc6
f4622ec
1244cc6
 
 
 
a8bf144
4fce288
104b149
a8bf144
1244cc6
bf26be5
 
 
a8bf144
 
1244cc6
9e789ed
a8bf144
1244cc6
09c9c95
1244cc6
 
a8bf144
 
1244cc6
 
 
 
06176bc
1244cc6
a8bf144
 
1244cc6
ab046ec
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
# import libraries
import torch
from transformers import pipeline
import gradio as gr
from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
from gradio.mix import Parallel, Series

# Display Text
desc = "Summarize your text!"

# Models I've fine tuned
qa_model = 'huggingface/SamuelMiller/qa_squad'
my_model_1 = 'huggingface/SamuelMiller/lil_sumsum'
my_model_2 = 'huggingface/SamuelMiller/lil_sum_sum'
my_model_3 = 'huggingface/SamuelMiller/sum_sum'

# Currently using this model for demo, from https://huggingface.co/google/pegasus-large
better_model = 'huggingface/google/pegasus-large'

# Summarize Function
def summarize(text):
  summ = gr.Interface.load(better_model)      
  summary = summ(text)
  return summary
  
# Gradio Interface  
iface = gr.Interface(fn=summarize,
                 theme='huggingface', 
                 title= 'sum_it', 
                 description= desc,
                 inputs= 'textbox',
                 outputs= 'textbox')
                 
# Launch Interface                 
iface.launch(inline = False)