File size: 1,954 Bytes
0923219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
import torch
import gradio as gr

# Use a pipeline as a high-level helper
from transformers import pipeline

# model_path = "../Models/models--sshleifer--distilbart-cnn-12-3/snapshots/e3a8f0dafad8b99df3209ff7cf33e1f8402619e1"

# pipe = pipeline("summarization", model="sshleifer/distilbart-cnn-12-3", torch_dtype=torch.bfloat16)

from transformers import pipeline

text_summary = pipeline("summarization", model="facebook/bart-large-cnn")

# text_summary = pipeline("summarization", model=model_path, torch_dtype=torch.bfloat16)

# text = "You are a front-end developer with 7 years of experience specializing in Angular, HTML, CSS, and JavaScript, currently working in an organization focused mainly on Angular. You’ve built complex Angular applications involving @Input() bindings, lazy loading, interceptors, and Highcharts integrations, and you pay strong attention to reusable, maintainable code structures. You’re actively enhancing your technical depth by learning data structures and algorithms to prepare for interviews at top tech companies, while also expanding your skill set by exploring React through a practical Task Management App project. Recently, you’ve been delving into micro frontends using Angular CLI 19 and Node 18.20.2, and you’ve chosen to transition toward becoming an AI-Integrated Front-End Engineer, combining your Angular expertise with Generative AI, large language models, and data visualization technologies to stay at the forefront of modern front-end innovation."

# print(text_summary(text))


def summary(input):
    output = text_summary(input)
    return output[0]["summary_text"]


gr.close_all()

# demo = gr.Interface(fn=summary, inputs="text", outputs="text")

demo = gr.Interface(
    fn=summary, 
    inputs=[gr.Textbox(label="Enter text to summarize", lines= 8)],
    outputs=[gr.Textbox(label="Summarized text", lines=8)],
    title="Vishakha's 1st GenAI App. Text Summarizer!!!!")

demo.launch()