Lord-Raven commited on
Commit
b3cb286
·
1 Parent(s): f03306d

Messing with configuration.

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -45,12 +45,16 @@ def classify(data_string, request: gradio.Request):
45
  if request.headers["origin"] not in ["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win", "https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win", "https://crunchatize-2-2b4f5b1479a6.c5v4v4jx6pq5.win", "https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://lord-raven.github.io"]:
46
  return "{}"
47
  data = json.loads(data_string)
 
 
 
 
48
  # if 'task' in data and data['task'] == 'few_shot_classification':
49
  # return few_shot_classification(data)
50
  # else:
51
  return zero_shot_classification(data)
52
 
53
- @spaces.GPU(duration=5)
54
  def zero_shot_classification(data):
55
  results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
56
  response_string = json.dumps(results)
 
45
  if request.headers["origin"] not in ["https://statosphere-3704059fdd7e.c5v4v4jx6pq5.win", "https://crunchatize-77a78ffcc6a6.c5v4v4jx6pq5.win", "https://crunchatize-2-2b4f5b1479a6.c5v4v4jx6pq5.win", "https://tamabotchi-2dba63df3bf1.c5v4v4jx6pq5.win", "https://ravenok-statosphere-backend.hf.space", "https://lord-raven.github.io"]:
46
  return "{}"
47
  data = json.loads(data_string)
48
+
49
+ # Prevent batch suggestion warning in log.
50
+ classifier.call_count = 0
51
+
52
  # if 'task' in data and data['task'] == 'few_shot_classification':
53
  # return few_shot_classification(data)
54
  # else:
55
  return zero_shot_classification(data)
56
 
57
+ @spaces.GPU(duration=3)
58
  def zero_shot_classification(data):
59
  results = classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
60
  response_string = json.dumps(results)