File size: 1,303 Bytes
4a93af1
c6d903d
 
 
628e3af
 
c6d903d
c6d9fb0
 
 
 
bae20b2
c6d9fb0
 
 
c6d903d
a37094d
c6d903d
 
 
4a93af1
 
 
ed909e7
10d7087
89fe9f7
 
ad0751b
6ec95e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask, jsonify, request
from transformers import AutoAdapterModel, AutoTokenizer, TextClassificationPipeline
from huggingface_hub import Repository

tokenizer = AutoTokenizer.from_pretrained("UBC-NLP/MARBERT")
model = AutoAdapterModel.from_pretrained("UBC-NLP/MARBERT")

# sarcasm_adapter = Repository(local_dir="sarcasm_adapter", clone_from="nehalelkaref/sarcasm_adapter")
# aoc3_adapter = Repository(local_dir="aoc3_adapter", clone_from="nehalelkaref/aoc3_adapter")
# aoc4_adapter = Repository(local_dir="aoc4_adapter", clone_from="nehalelkaref/aoc4_adapter")
# fusion_adapter = Repository(local_dir="fusion_adapter", clone_from="nehalelkaref/region_fusion")

model.load_adapter("nehalelkaref/aoc3_adapter", set_active=True, with_head=False, source="hf")
model.load_adapter("nehalelkaref/aoc4_adapter", set_active=True, with_head=False, source="hf")
model.load_adapter("nehalelkaref/sarcasm_adapter", set_active=True, with_head=False, source="hf")

# model.load_adapter_fusion("nehalelkaref/region_fusion",with_head=True, set_active=True, source="hf")

pipe = TextClassificationPipeline(tokenizer=tokenizer, model=model)


app = Flask(__name__)

@app.route("/", methods=['GET'])
def home():
    return "<h1>GFG is great platform to learn</h1>"

if __name__ == "__main__":
  app.run()