Spaces:
Running
on
Zero
Running
on
Zero
directly applied decorator
Browse files
app.py
CHANGED
@@ -108,11 +108,12 @@ def no_op_decorator(func):
|
|
108 |
return func(*args, **kwargs)
|
109 |
return wrapper
|
110 |
|
111 |
-
# Decide which decorator to use based on environment
|
112 |
-
decorator_to_use = spaces.GPU() if is_running_in_hf_space() else no_op_decorator
|
113 |
-
#duration=120
|
114 |
|
115 |
-
@decorator_to_use
|
|
|
116 |
def create_embeddings(texts_to_embedd):
|
117 |
"""Create embeddings for the input texts using the loaded model."""
|
118 |
return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
|
|
|
108 |
return func(*args, **kwargs)
|
109 |
return wrapper
|
110 |
|
111 |
+
# # Decide which decorator to use based on environment
|
112 |
+
# decorator_to_use = spaces.GPU() if is_running_in_hf_space() else no_op_decorator
|
113 |
+
# #duration=120
|
114 |
|
115 |
+
# @decorator_to_use
|
116 |
+
@spaces.GPU()
|
117 |
def create_embeddings(texts_to_embedd):
|
118 |
"""Create embeddings for the input texts using the loaded model."""
|
119 |
return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
|