Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,11 +2,9 @@ import streamlit as st
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Summarization
|
| 5 |
-
def summarization(
|
| 6 |
-
with open(image_path, "rb") as image_file:
|
| 7 |
-
bytes_data = image_file.read()
|
| 8 |
image_to_text_model = pipeline("text-generation", model="ainize/bart-base-cnn")
|
| 9 |
-
summary = image_to_text_model(
|
| 10 |
return summary
|
| 11 |
|
| 12 |
# Sentiment Classification
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
# Summarization
|
| 5 |
+
def summarization(text):
|
|
|
|
|
|
|
| 6 |
image_to_text_model = pipeline("text-generation", model="ainize/bart-base-cnn")
|
| 7 |
+
summary = image_to_text_model(text, max_length=100, do_sample=False)[0]["generated_text"]
|
| 8 |
return summary
|
| 9 |
|
| 10 |
# Sentiment Classification
|