Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
|
| 5 |
+
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
|
| 6 |
+
|
| 7 |
+
def summary (input):
|
| 8 |
+
output = text_summary(input)
|
| 9 |
+
return output[0]["summary_text"]
|
| 10 |
+
|
| 11 |
+
gr.close_all()
|
| 12 |
+
op = gr.Interface(fn=summary,
|
| 13 |
+
inputs= [gr.Textbox(label="Enter the text:",lines=6)],
|
| 14 |
+
outputs= [gr.Textbox(label="Summerized Text:", lines=4)],
|
| 15 |
+
title="Text Summarizer GenAI Project1",
|
| 16 |
+
description = "This is my first project to summarize any data.")
|
| 17 |
+
op.launch()
|