Spaces:
Runtime error
Runtime error
nehalelkaref
commited on
Commit
•
7ff0c05
1
Parent(s):
7949948
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,21 @@
|
|
1 |
from flask import Flask, jsonify, request, render_template
|
2 |
from transformers import AutoAdapterModel, AutoTokenizer, TextClassificationPipeline
|
3 |
-
from huggingface_hub import Repository
|
4 |
|
5 |
-
tokenizer = AutoTokenizer.from_pretrained("UBC-NLP/MARBERT")
|
6 |
-
model = AutoAdapterModel.from_pretrained("UBC-NLP/MARBERT")
|
7 |
|
8 |
# sarcasm_adapter = Repository(local_dir="sarcasm_adapter", clone_from="nehalelkaref/sarcasm_adapter")
|
9 |
# aoc3_adapter = Repository(local_dir="aoc3_adapter", clone_from="nehalelkaref/aoc3_adapter")
|
10 |
# aoc4_adapter = Repository(local_dir="aoc4_adapter", clone_from="nehalelkaref/aoc4_adapter")
|
11 |
# fusion_adapter = Repository(local_dir="fusion_adapter", clone_from="nehalelkaref/region_fusion")
|
12 |
|
13 |
-
model.load_adapter("nehalelkaref/aoc3_adapter", set_active=True, with_head=False, source="hf")
|
14 |
-
model.load_adapter("nehalelkaref/aoc4_adapter", set_active=True, with_head=False, source="hf")
|
15 |
-
model.load_adapter("nehalelkaref/sarcasm_adapter", set_active=True, with_head=False, source="hf")
|
16 |
|
17 |
# model.load_adapter_fusion("nehalelkaref/region_fusion",with_head=True, set_active=True, source="hf")
|
18 |
|
19 |
-
pipe = TextClassificationPipeline(tokenizer=tokenizer, model=model)
|
20 |
|
21 |
|
22 |
app = Flask(__name__)
|
@@ -25,5 +24,9 @@ app = Flask(__name__)
|
|
25 |
def home():
|
26 |
return render_template('home.html')
|
27 |
|
|
|
|
|
|
|
|
|
28 |
if __name__ == "__main__":
|
29 |
app.run()
|
|
|
1 |
from flask import Flask, jsonify, request, render_template
|
2 |
from transformers import AutoAdapterModel, AutoTokenizer, TextClassificationPipeline
|
|
|
3 |
|
4 |
+
# tokenizer = AutoTokenizer.from_pretrained("UBC-NLP/MARBERT")
|
5 |
+
# model = AutoAdapterModel.from_pretrained("UBC-NLP/MARBERT")
|
6 |
|
7 |
# sarcasm_adapter = Repository(local_dir="sarcasm_adapter", clone_from="nehalelkaref/sarcasm_adapter")
|
8 |
# aoc3_adapter = Repository(local_dir="aoc3_adapter", clone_from="nehalelkaref/aoc3_adapter")
|
9 |
# aoc4_adapter = Repository(local_dir="aoc4_adapter", clone_from="nehalelkaref/aoc4_adapter")
|
10 |
# fusion_adapter = Repository(local_dir="fusion_adapter", clone_from="nehalelkaref/region_fusion")
|
11 |
|
12 |
+
# model.load_adapter("nehalelkaref/aoc3_adapter", set_active=True, with_head=False, source="hf")
|
13 |
+
# model.load_adapter("nehalelkaref/aoc4_adapter", set_active=True, with_head=False, source="hf")
|
14 |
+
# model.load_adapter("nehalelkaref/sarcasm_adapter", set_active=True, with_head=False, source="hf")
|
15 |
|
16 |
# model.load_adapter_fusion("nehalelkaref/region_fusion",with_head=True, set_active=True, source="hf")
|
17 |
|
18 |
+
# pipe = TextClassificationPipeline(tokenizer=tokenizer, model=model)
|
19 |
|
20 |
|
21 |
app = Flask(__name__)
|
|
|
24 |
def home():
|
25 |
return render_template('home.html')
|
26 |
|
27 |
+
@app.route('/classify', methods = ['POST'])
|
28 |
+
def classify():
|
29 |
+
return "<h> text <\h>"
|
30 |
+
|
31 |
if __name__ == "__main__":
|
32 |
app.run()
|