Spaces:
Running
on
Zero
Running
on
Zero
Lord-Raven
commited on
Commit
·
cd2c95d
1
Parent(s):
b3cb286
Messing with configuration.
Browse files
app.py
CHANGED
|
@@ -52,13 +52,11 @@ def classify(data_string, request: gradio.Request):
|
|
| 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 |
-
|
| 60 |
-
response_string = json.dumps(results)
|
| 61 |
-
return response_string
|
| 62 |
|
| 63 |
def create_sequences(data):
|
| 64 |
# return ['###Given:\n' + data['sequence'] + '\n###End Given\n###Hypothesis:\n' + data['hypothesis_template'].format(label) + "\n###End Hypothesis" for label in data['candidate_labels']]
|
|
|
|
| 52 |
# if 'task' in data and data['task'] == 'few_shot_classification':
|
| 53 |
# return few_shot_classification(data)
|
| 54 |
# else:
|
| 55 |
+
return json.dumps(zero_shot_classification(data))
|
| 56 |
|
| 57 |
@spaces.GPU(duration=3)
|
| 58 |
def zero_shot_classification(data):
|
| 59 |
+
return classifier(data['sequence'], candidate_labels=data['candidate_labels'], hypothesis_template=data['hypothesis_template'], multi_label=data['multi_label'])
|
|
|
|
|
|
|
| 60 |
|
| 61 |
def create_sequences(data):
|
| 62 |
# return ['###Given:\n' + data['sequence'] + '\n###End Given\n###Hypothesis:\n' + data['hypothesis_template'].format(label) + "\n###End Hypothesis" for label in data['candidate_labels']]
|