Spaces:
Runtime error
Runtime error
Enable spaces GPU
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ from sentence_transformers import SentenceTransformer
|
|
| 26 |
from dotenv import load_dotenv
|
| 27 |
import os
|
| 28 |
|
| 29 |
-
|
| 30 |
import gradio as gr
|
| 31 |
|
| 32 |
|
|
@@ -151,13 +151,13 @@ def get_docs_from_parquet(parquet_urls, column, offset, limit):
|
|
| 151 |
return df[column].tolist()
|
| 152 |
|
| 153 |
|
| 154 |
-
|
| 155 |
# TODO: Modify batch size to reduce memory consumption during embedding calculation, which value is better?
|
| 156 |
def calculate_embeddings(docs):
|
| 157 |
return sentence_model.encode(docs, show_progress_bar=True, batch_size=32)
|
| 158 |
|
| 159 |
|
| 160 |
-
|
| 161 |
def fit_model(docs, embeddings):
|
| 162 |
global global_topic_model
|
| 163 |
|
|
|
|
| 26 |
from dotenv import load_dotenv
|
| 27 |
import os
|
| 28 |
|
| 29 |
+
import spaces
|
| 30 |
import gradio as gr
|
| 31 |
|
| 32 |
|
|
|
|
| 151 |
return df[column].tolist()
|
| 152 |
|
| 153 |
|
| 154 |
+
@spaces.GPU
|
| 155 |
# TODO: Modify batch size to reduce memory consumption during embedding calculation, which value is better?
|
| 156 |
def calculate_embeddings(docs):
|
| 157 |
return sentence_model.encode(docs, show_progress_bar=True, batch_size=32)
|
| 158 |
|
| 159 |
|
| 160 |
+
@spaces.GPU
|
| 161 |
def fit_model(docs, embeddings):
|
| 162 |
global global_topic_model
|
| 163 |
|