I'm sorry in advance for the rookie question. I'm learning Flask and I have a Python file that I'm now using in a Flask app. When I run the app.py file in Python (python app.py), everything works. However, when I run it in Flask, I get the error: AttributeError: 'Flask' object has no attribute 'tagger'.
The resTag function is trying to return a response from the Tagger -> tag function. The result is the error message, mentioned above.
Any advice?
app.py
app = Flask(__name__)
@app.route('/')
def resTag():
text = request.values['text']
tokenized = request.values.get('tokenized') in ('1', 'True', 'true')
return app.tagger.tag(text, tokenized)
class Tagger(object):
def __init__(self, model, tokenizer, labels, config):
self.model = model
self.tokenizer = tokenizer
self.labels = labels
self.config = config
self.session = None
self.graph = None
def tag(self, text, tokenized=False):
# Stuff to do