Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,8 @@ import gradio as gr
|
|
| 3 |
from transformers import AutoModel, AutoProcessor
|
| 4 |
import torch
|
| 5 |
import requests
|
| 6 |
-
from
|
|
|
|
| 7 |
|
| 8 |
# Import a specific model
|
| 9 |
model_name = "facebook/bart-large-cnn"
|
|
@@ -13,7 +14,7 @@ summarizer = pipeline("summarization", model=model_name)
|
|
| 13 |
|
| 14 |
# Define a function that takes a text and returns a summary
|
| 15 |
def summarize(input_text):
|
| 16 |
-
summary = summarizer(input_text, max_length=
|
| 17 |
return summary[0]["summary_text"]
|
| 18 |
|
| 19 |
# Create a Gradio interface
|
|
|
|
| 3 |
from transformers import AutoModel, AutoProcessor
|
| 4 |
import torch
|
| 5 |
import requests
|
| 6 |
+
from PIL import Image
|
| 7 |
+
from io import BytesIO
|
| 8 |
|
| 9 |
# Import a specific model
|
| 10 |
model_name = "facebook/bart-large-cnn"
|
|
|
|
| 14 |
|
| 15 |
# Define a function that takes a text and returns a summary
|
| 16 |
def summarize(input_text):
|
| 17 |
+
summary = summarizer(input_text, max_length=100, min_length=10, do_sample=False)
|
| 18 |
return summary[0]["summary_text"]
|
| 19 |
|
| 20 |
# Create a Gradio interface
|