File size: 549 Bytes
01f5d43
 
 
 
 
 
 
 
 
 
 
8ed289a
01f5d43
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr

from simplet5 import SimpleT5
model = SimpleT5()
model.from_pretrained(model_type="t5", model_name="t5-base")

def summarize(text_input):

  if text_input == None:
    return None

  model.load_model("data.pkl", use_gpu=False)
  text_to_summarize = """summarize: """ + text_input
  predicted_output = model.predict(text_to_summarize)
  return predicted_output


text_i = gr.inputs.Textbox(lines=10, placeholder="Enter text", label="Text")

iface = gr.Interface(fn = summarize, inputs = text_i, outputs="textbox")

iface.launch()