Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,10 @@
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
-
# Use a pipeline as a high-level helper
|
4 |
from transformers import pipeline
|
5 |
|
|
|
6 |
text_summary = pipeline("summarization", model="Falconsai/text_summarization",
|
7 |
-
|
8 |
-
#model_path =("../Models/models--Falconsai--text_summarization/snapshots"
|
9 |
-
# "/6e505f907968c4a9360773ff57885cdc6dca4bfd")
|
10 |
-
#text_summary= pipeline("summarization", model=model_path,
|
11 |
-
# torch_dtype=torch.bfloat16)
|
12 |
-
|
13 |
-
#text="Artificial Intelligence (AI) is transforming our world by enabling machines to perform tasks that typically require human intelligence. From automating routine tasks to advancing scientific research, AI's impact is profound. It powers everything from chatbots and virtual assistants to self-driving cars and medical diagnostics. By leveraging vast amounts of data, AI systems can learn, adapt, and improve over time. Ethical considerations and transparency are vital as AI continues to evolve. The potential for AI to enhance productivity, innovation, and quality of life is immense. Embracing AI responsibly can lead to a brighter, more efficient future for all."
|
14 |
-
#print(text_summary(text));
|
15 |
|
16 |
def summary(input):
|
17 |
output = text_summary(input)
|
@@ -19,11 +12,13 @@ def summary(input):
|
|
19 |
|
20 |
gr.close_all()
|
21 |
|
22 |
-
#
|
23 |
-
demo=gr.Interface(
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
demo.launch()
|
|
|
1 |
import torch
|
2 |
import gradio as gr
|
|
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
# Use a pipeline as a high-level helper
|
6 |
text_summary = pipeline("summarization", model="Falconsai/text_summarization",
|
7 |
+
torch_dtype=torch.bfloat16)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
def summary(input):
|
10 |
output = text_summary(input)
|
|
|
12 |
|
13 |
gr.close_all()
|
14 |
|
15 |
+
# Create the Gradio interface
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=summary,
|
18 |
+
inputs=[gr.Textbox(label="INPUT THE PASSAGE TO SUMMARIZE", lines=10)],
|
19 |
+
outputs=[gr.Textbox(label="SUMMARIZED TEXT", lines=4)],
|
20 |
+
title="PAVISHINI @ GenAI Project 1: Text Summarizer",
|
21 |
+
description="This application is used to summarize the text"
|
22 |
+
)
|
23 |
|
24 |
+
demo.launch()
|