Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from datasets import load_dataset
|
|
3 |
import random
|
4 |
import numpy as np
|
5 |
from transformers import CLIPProcessor, CLIPModel
|
6 |
-
import
|
7 |
|
8 |
# Load the pre-trained model and processor
|
9 |
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
@@ -29,7 +29,7 @@ def rand_image():
|
|
29 |
def set_labels(text):
|
30 |
return text.split(",")
|
31 |
|
32 |
-
get_caption = gr.load("ryaalbr/caption", src="spaces", hf_token=
|
33 |
def generate_text(image):
|
34 |
return get_caption(image)
|
35 |
|
|
|
3 |
import random
|
4 |
import numpy as np
|
5 |
from transformers import CLIPProcessor, CLIPModel
|
6 |
+
from os import environ
|
7 |
|
8 |
# Load the pre-trained model and processor
|
9 |
model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
|
|
29 |
def set_labels(text):
|
30 |
return text.split(",")
|
31 |
|
32 |
+
get_caption = gr.load("ryaalbr/caption", src="spaces", hf_token=environ("api_key"))
|
33 |
def generate_text(image):
|
34 |
return get_caption(image)
|
35 |
|