Spaces:
Running
Running
update main
#5
by
MsChabane
- opened
main.py
CHANGED
|
@@ -18,6 +18,8 @@ from pptx import Presentation
|
|
| 18 |
import seaborn as sns
|
| 19 |
import PIL.Image as Image
|
| 20 |
|
|
|
|
|
|
|
| 21 |
import fitz
|
| 22 |
|
| 23 |
|
|
@@ -38,20 +40,22 @@ try:
|
|
| 38 |
except Exception as exp:
|
| 39 |
print("[ERROR] Can't load nlpconnect/vit-gpt2-image-captioning")
|
| 40 |
print(str(exp))
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
# summarizer = pipeline("summarization", model="facebook/bart-large-cnn",device=0)
|
| 44 |
-
#except Exception as exp:
|
| 45 |
-
# print("[ERROR] Can't load facebook/bart-large-cnn ")
|
| 46 |
-
# print(str(exp))
|
| 47 |
|
| 48 |
try:
|
| 49 |
-
|
| 50 |
-
except
|
| 51 |
-
print(
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
summarizer_tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
|
| 55 |
|
| 56 |
|
| 57 |
|
|
|
|
| 18 |
import seaborn as sns
|
| 19 |
import PIL.Image as Image
|
| 20 |
|
| 21 |
+
|
| 22 |
+
|
| 23 |
import fitz
|
| 24 |
|
| 25 |
|
|
|
|
| 40 |
except Exception as exp:
|
| 41 |
print("[ERROR] Can't load nlpconnect/vit-gpt2-image-captioning")
|
| 42 |
print(str(exp))
|
| 43 |
+
|
| 44 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
try:
|
| 47 |
+
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 48 |
+
except Exception as exp:
|
| 49 |
+
print("[ERROR] Can't load facebook/bart-large-cnn ")
|
| 50 |
+
print(str(exp))
|
| 51 |
+
|
| 52 |
+
#try:
|
| 53 |
+
# summarizer_model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
|
| 54 |
+
#except OSError as e:
|
| 55 |
+
# print(f"[INFO] PyTorch weights not found. Falling back to TensorFlow weights.\n{e}")
|
| 56 |
+
# summarizer_model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn", from_tf=True)
|
| 57 |
|
| 58 |
+
#summarizer_tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
|
| 59 |
|
| 60 |
|
| 61 |
|