m7n commited on
Commit
729998e
·
1 Parent(s): 0516b4c

added spaces to predict

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import time
2
  print(f"Starting up: {time.strftime('%Y-%m-%d %H:%M:%S')}")
3
 
@@ -120,6 +122,7 @@ def create_embeddings(texts_to_embedd):
120
  return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
121
 
122
 
 
123
  def predict(text_input, sample_size_slider, reduce_sample_checkbox, sample_reduction_method,
124
  plot_time_checkbox, locally_approximate_publication_date_checkbox,
125
  download_csv_checkbox, download_png_checkbox,citation_graph_checkbox, progress=gr.Progress()):
 
1
+ import spaces # necessary to run on Zero.
2
+
3
  import time
4
  print(f"Starting up: {time.strftime('%Y-%m-%d %H:%M:%S')}")
5
 
 
122
  return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
123
 
124
 
125
+ @spaces.GPU
126
  def predict(text_input, sample_size_slider, reduce_sample_checkbox, sample_reduction_method,
127
  plot_time_checkbox, locally_approximate_publication_date_checkbox,
128
  download_csv_checkbox, download_png_checkbox,citation_graph_checkbox, progress=gr.Progress()):