Spaces:
Running
Running
commit main
Browse files
main.py
CHANGED
|
@@ -37,9 +37,12 @@ app.add_middleware(
|
|
| 37 |
from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
|
| 38 |
try:
|
| 39 |
interpreter =None
|
|
|
|
| 40 |
interpreter =pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 41 |
if interpreter is None :
|
| 42 |
print("\n\n interpreter is nonne \n\n")
|
|
|
|
|
|
|
| 43 |
#interpreter_model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 44 |
#interpreter_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 45 |
#interpreter_tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
|
@@ -51,9 +54,12 @@ except Exception as exp:
|
|
| 51 |
|
| 52 |
try:
|
| 53 |
summarizer=None
|
|
|
|
| 54 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 55 |
if summarizer is None :
|
| 56 |
print("\n\n summarizer is nonne \n\n")
|
|
|
|
|
|
|
| 57 |
except Exception as exp:
|
| 58 |
print("[ERROR] Can't load facebook/bart-large-cnn ")
|
| 59 |
print(str(exp))
|
|
@@ -70,9 +76,12 @@ except Exception as exp:
|
|
| 70 |
|
| 71 |
try:
|
| 72 |
generator=None
|
|
|
|
| 73 |
generator = pipeline("text-generation", model="deepseek-ai/deepseek-coder-1.3b-instruct")
|
| 74 |
if generator is None :
|
| 75 |
print("\n\n generator is nonne \n\n")
|
|
|
|
|
|
|
| 76 |
except Exception as exp:
|
| 77 |
print("[ERROR] Can't load deepseek-ai/deepseek-coder-1.3b-instruct ")
|
| 78 |
print(str(exp))
|
|
|
|
| 37 |
from transformers import VisionEncoderDecoderModel, ViTImageProcessor, AutoTokenizer
|
| 38 |
try:
|
| 39 |
interpreter =None
|
| 40 |
+
print("installing interpreter ...")
|
| 41 |
interpreter =pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 42 |
if interpreter is None :
|
| 43 |
print("\n\n interpreter is nonne \n\n")
|
| 44 |
+
else:
|
| 45 |
+
print(" interpreter installed.")
|
| 46 |
#interpreter_model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 47 |
#interpreter_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
| 48 |
#interpreter_tokenizer = AutoTokenizer.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
|
|
|
|
| 54 |
|
| 55 |
try:
|
| 56 |
summarizer=None
|
| 57 |
+
print ("installing summarizer ...")
|
| 58 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 59 |
if summarizer is None :
|
| 60 |
print("\n\n summarizer is nonne \n\n")
|
| 61 |
+
else:
|
| 62 |
+
print(" summarizer installed.")
|
| 63 |
except Exception as exp:
|
| 64 |
print("[ERROR] Can't load facebook/bart-large-cnn ")
|
| 65 |
print(str(exp))
|
|
|
|
| 76 |
|
| 77 |
try:
|
| 78 |
generator=None
|
| 79 |
+
print("installing generator ...")
|
| 80 |
generator = pipeline("text-generation", model="deepseek-ai/deepseek-coder-1.3b-instruct")
|
| 81 |
if generator is None :
|
| 82 |
print("\n\n generator is nonne \n\n")
|
| 83 |
+
else:
|
| 84 |
+
print(" generator installed.")
|
| 85 |
except Exception as exp:
|
| 86 |
print("[ERROR] Can't load deepseek-ai/deepseek-coder-1.3b-instruct ")
|
| 87 |
print(str(exp))
|