llama-2-7b-chat / ChatController.py
safihaider's picture
initial commit
95555b8
raw
history blame
482 Bytes
from flask import Flask, request
from flask_cors import CORS, cross_origin
from ChatService import ChatService
import os
os.environ['TRANSFORMERS_CACHE'] = './cache/'
os.environ['SENTENCE_TRANSFORMERS_HOME'] = './cache/'
app = Flask(__name__)
CORS(app)
chatService = ChatService()
chatService.load_model("meta-llama/Llama-2-7b-chat-hf")
@app.route("/chat", methods=['POST'])
@cross_origin(origin='*')
def hello_world():
return chatService.generate_message(request.get_json())