prod sysvar
This commit is contained in:
parent
991313006d
commit
96d5e61c9b
3 changed files with 10 additions and 6 deletions
3
.github/workflows/main_volucy-gateway.yml
vendored
3
.github/workflows/main_volucy-gateway.yml
vendored
|
|
@ -66,6 +66,9 @@ jobs:
|
|||
- name: Unzip artifact for deployment
|
||||
run: unzip release.zip
|
||||
|
||||
- name: Set environment variable for Flask
|
||||
run: echo "FLASK_ENV=production" >> $GITHUB_ENV
|
||||
|
||||
- name: 'Deploy to Azure Web App'
|
||||
uses: azure/webapps-deploy@v2
|
||||
id: deploy-to-webapp
|
||||
|
|
|
|||
10
main.py
10
main.py
|
|
@ -1,5 +1,4 @@
|
|||
# pip install Flask requests
|
||||
# pip install openai
|
||||
# pip install Flask requests gunicorn
|
||||
|
||||
from flask import Flask, request, jsonify
|
||||
import requests
|
||||
|
|
@ -7,7 +6,6 @@ import openai
|
|||
|
||||
openai.api_key = "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"
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Define the routes for the gateway
|
||||
|
|
@ -30,7 +28,7 @@ def gpt4_proxy():
|
|||
data = request.json
|
||||
prompt = data.get('prompt', '')
|
||||
model = 'gpt-4'
|
||||
response = openai.chat.completions.create(
|
||||
response = openai.ChatCompletion.create(
|
||||
messages=[
|
||||
{
|
||||
"role": "user",
|
||||
|
|
@ -41,6 +39,8 @@ def gpt4_proxy():
|
|||
)
|
||||
return jsonify({'response': response.choices[0].message.content.strip()})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
|
||||
# start with: gunicorn -w 4 -b 0.0.0.0:8000 app:app
|
||||
# export FLASK_ENV=production
|
||||
|
|
@ -4,5 +4,6 @@ django-cors-headers
|
|||
djangorestframework
|
||||
whitenoise
|
||||
openai
|
||||
Flask
|
||||
requests
|
||||
flask
|
||||
gunicorn
|
||||
Loading…
Reference in a new issue