Spaces:
Sleeping
Sleeping
# 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) | |