Spaces:
Sleeping
Sleeping
Commit
·
de4975e
1
Parent(s):
fd5008e
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
|
| 2 |
from transformers import AutoAdapterModel, AutoTokenizer, TextClassificationPipeline
|
| 3 |
from huggingface_hub import Repository
|
| 4 |
|
| 5 |
-
app = Flask(__name__)
|
| 6 |
|
| 7 |
#define model
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained("UBC-NLP/MARBERT")
|
|
@@ -22,15 +22,15 @@ model.load_adapter_fusion("/fusion_adapter/aoc(3),aoc(4),sarcasm",with_head=True
|
|
| 22 |
|
| 23 |
pipe = TextClassificationPipeline(tokenizer=tokenizer, model=model)
|
| 24 |
|
| 25 |
-
@app.route('/predict', methods=['POST'])
|
| 26 |
-
def predict():
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
|
|
|
|
| 1 |
+
|
| 2 |
from transformers import AutoAdapterModel, AutoTokenizer, TextClassificationPipeline
|
| 3 |
from huggingface_hub import Repository
|
| 4 |
|
| 5 |
+
# app = Flask(__name__)
|
| 6 |
|
| 7 |
#define model
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained("UBC-NLP/MARBERT")
|
|
|
|
| 22 |
|
| 23 |
pipe = TextClassificationPipeline(tokenizer=tokenizer, model=model)
|
| 24 |
|
| 25 |
+
# @app.route('/predict', methods=['POST'])
|
| 26 |
+
# def predict():
|
| 27 |
+
# text = request.json['inputs']
|
| 28 |
|
| 29 |
+
# prediction = pipe(text)
|
| 30 |
+
# labels = {"LABEL_0":"GULF", "LABEL_1":"LEVANT","LABEL_2":"EGYPT"}
|
| 31 |
+
# regions = []
|
| 32 |
+
# for res in prediction:
|
| 33 |
+
# regions.append(labels[res['label']])
|
| 34 |
|
| 35 |
+
# return jsonify({'response': regions})
|
| 36 |
|