Spaces:
Runtime error
Runtime error
no more zerogpu
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import Union
|
|
| 2 |
import gradio as gr
|
| 3 |
from numpy import empty
|
| 4 |
import open_clip
|
| 5 |
-
import spaces
|
| 6 |
import torch
|
| 7 |
import PIL.Image as Image
|
| 8 |
|
|
@@ -22,7 +22,7 @@ model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms(
|
|
| 22 |
|
| 23 |
|
| 24 |
# Define function to generate text embeddings
|
| 25 |
-
@spaces.GPU
|
| 26 |
def generate_text_embedding(text_data: Union[str, tuple[str]]) -> list[str]:
|
| 27 |
"""
|
| 28 |
Generate embeddings for text data using the OpenCLIP model.
|
|
@@ -78,7 +78,7 @@ def generate_text_embedding(text_data: Union[str, tuple[str]]) -> list[str]:
|
|
| 78 |
return text_embeddings
|
| 79 |
|
| 80 |
# Define function to generate image embeddings
|
| 81 |
-
@spaces.GPU
|
| 82 |
def generate_image_embedding(image_data: Union[Image.Image, tuple[Image.Image]]) -> list[str]:
|
| 83 |
"""
|
| 84 |
Generate embeddings for image data using the OpenCLIP model.
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from numpy import empty
|
| 4 |
import open_clip
|
| 5 |
+
# import spaces
|
| 6 |
import torch
|
| 7 |
import PIL.Image as Image
|
| 8 |
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
# Define function to generate text embeddings
|
| 25 |
+
# @spaces.GPU
|
| 26 |
def generate_text_embedding(text_data: Union[str, tuple[str]]) -> list[str]:
|
| 27 |
"""
|
| 28 |
Generate embeddings for text data using the OpenCLIP model.
|
|
|
|
| 78 |
return text_embeddings
|
| 79 |
|
| 80 |
# Define function to generate image embeddings
|
| 81 |
+
# @spaces.GPU
|
| 82 |
def generate_image_embedding(image_data: Union[Image.Image, tuple[Image.Image]]) -> list[str]:
|
| 83 |
"""
|
| 84 |
Generate embeddings for image data using the OpenCLIP model.
|