File size: 932 Bytes
e7d1408
 
 
 
 
 
 
 
 
 
 
 
95de959
e7d1408
 
95f0980
 
95de959
 
 
 
95f0980
e7d1408
95de959
e7d1408
 
86998ec
e7d1408
 
 
 
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
import gradio as gr
from transformers import pipeline

pipe = pipeline("summarization", model="lidiya/bart-large-xsum-samsum")

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("""# Teste Sumarizacao!""")
  with gr.Row():
    with gr.Column():
      text1 = gr.Textbox(label="""Diálogo""",
            lines=1,value="""Hannah: Ei, você tem o número da Betty?
Amanda: Deixa eu checar
Amanda: Desculpe, não encontrei.
Amanda: Pergunte ao Larry
Amanda: Ele ligou para ela da última vez que estivemos juntos no parque
Hannah: eu não o conheço bem"""
        )
      output = gr.Textbox(label="Resultado")
      b1 = gr.Button("Summarize!")
      b1.click(main, inputs=[text1], outputs=output)
  gr.Markdown("""#### powered by [cloudqi]""")


if __name__ == "__main__":
    demo.launch(debug=True)