SamuelMiller commited on
Commit
a8bf144
1 Parent(s): 06176bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,28 +1,36 @@
 
1
  import torch
2
  from transformers import pipeline
3
  import gradio as gr
4
  from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
5
  from gradio.mix import Parallel, Series
6
 
7
-
8
  desc = "Summarize your text! (audio transcription available soon)"
9
 
10
-
11
  qa_model = 'huggingface/SamuelMiller/qa_squad'
12
  my_model_1 = 'huggingface/SamuelMiller/lil_sumsum'
13
  my_model_2 = 'huggingface/SamuelMiller/lil_sum_sum'
14
  my_model_3 = 'huggingface/SamuelMiller/sum_sum'
 
 
15
  better_model = 'huggingface/google/pegasus-large'
16
 
 
17
  def summarize(text):
18
  summ = gr.Interface.load(better_model)
19
  summary = summ(text)
20
  return summary
 
 
21
  iface = gr.Interface(fn=summarize,
22
  theme='huggingface',
23
  title= 'sum_it',
24
  description= desc,
25
  inputs= 'textbox',
26
  outputs= 'textbox')
 
 
27
  iface.launch(inline = False)
28
 
 
1
+ # import libraries
2
  import torch
3
  from transformers import pipeline
4
  import gradio as gr
5
  from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
6
  from gradio.mix import Parallel, Series
7
 
8
+ # Display Text
9
  desc = "Summarize your text! (audio transcription available soon)"
10
 
11
+ # Models I've fine tuned
12
  qa_model = 'huggingface/SamuelMiller/qa_squad'
13
  my_model_1 = 'huggingface/SamuelMiller/lil_sumsum'
14
  my_model_2 = 'huggingface/SamuelMiller/lil_sum_sum'
15
  my_model_3 = 'huggingface/SamuelMiller/sum_sum'
16
+
17
+ # Currently using this model for demo, from https://huggingface.co/google/pegasus-large
18
  better_model = 'huggingface/google/pegasus-large'
19
 
20
+ # Summarize Function
21
  def summarize(text):
22
  summ = gr.Interface.load(better_model)
23
  summary = summ(text)
24
  return summary
25
+
26
+ # Gradio Interface
27
  iface = gr.Interface(fn=summarize,
28
  theme='huggingface',
29
  title= 'sum_it',
30
  description= desc,
31
  inputs= 'textbox',
32
  outputs= 'textbox')
33
+
34
+ # Launch Interface
35
  iface.launch(inline = False)
36