m7n commited on
Commit
3d53dd3
·
1 Parent(s): 60c1b0a

fixing local run

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -148,6 +148,10 @@ else:
148
  return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
149
 
150
 
 
 
 
 
151
 
152
  def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_checkbox,
153
  sample_reduction_method, plot_time_checkbox,
@@ -171,13 +175,14 @@ def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_c
171
  tuple: (link to visualization, iframe HTML)
172
  """
173
  # Get the authentication token
174
- token = _get_token(request)
175
-
176
-
177
- payload = token.split('.')[1]
178
- payload = f"{payload}{'=' * ((4 - len(payload) % 4) % 4)}"
179
- payload = json.loads(base64.urlsafe_b64decode(payload).decode())
180
- print(payload)
 
181
 
182
  # Check if input is empty or whitespace
183
  print(f"Input: {text_input}")
 
148
  return model.encode(texts_to_embedd, show_progress_bar=True, batch_size=192)
149
 
150
 
151
+
152
+
153
+
154
+
155
 
156
  def predict(request: gr.Request, text_input, sample_size_slider, reduce_sample_checkbox,
157
  sample_reduction_method, plot_time_checkbox,
 
175
  tuple: (link to visualization, iframe HTML)
176
  """
177
  # Get the authentication token
178
+ if is_running_in_hf_space():
179
+ token = _get_token(request)
180
+ payload = token.split('.')[1]
181
+ payload = f"{payload}{'=' * ((4 - len(payload) % 4) % 4)}"
182
+ payload = json.loads(base64.urlsafe_b64decode(payload).decode())
183
+ print(payload)
184
+ else:
185
+ pass
186
 
187
  # Check if input is empty or whitespace
188
  print(f"Input: {text_input}")