import gradio as gr from transformers import pipeline pipe = pipeline("summarization", model="cloudqi/cqi_brain_memory_summarizer_large_pt_v0") def main(in_text): print(in_text) answer = pipe(in_text, min_length=5, max_length=20) print(answer) return answer[0]["summary_text"] with gr.Blocks() as demo: gr.Markdown("""## Sumarizer Open Version""") with gr.Row(): with gr.Column(): text1 = gr.Textbox(label="""Diálogo""", lines=1,value="""Bruno: Ei, você tem o número da Betty? Kleber: Desculpe, não encontrei. Bruno: Pesquise. Kleber: De acordo com minha pesquisa o número é 35 9 9898-6142""" ) output = gr.Textbox(label="Resultado") b1 = gr.Button("Summarize!") b1.click(main, inputs=[text1], outputs=output) gr.Markdown("""###### Model cqi_brain_memory_summarizer_large_pt_v0 designed by [cloudqi]""") if __name__ == "__main__": demo.launch(debug=True)