push clean
This commit is contained in:
parent
766c0d1ac2
commit
944ce3eae8
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
||||
docker-compose.yml
|
||||
models/
|
||||
images/
|
||||
app/bin
|
||||
app/lib
|
||||
app/lib64
|
||||
app/__pycache__
|
||||
app/pyvenv.cfg
|
||||
app/include
|
||||
19
.env
Normal file
19
.env
Normal file
@ -0,0 +1,19 @@
|
||||
#########################LOCALAI#########################
|
||||
|
||||
# local-ai quand flask dockerisé
|
||||
LOCALAI_HOST=local-ai
|
||||
|
||||
MODELS_PATH=/models
|
||||
|
||||
DEBUG=true
|
||||
REBUILD=false
|
||||
|
||||
#THREADS=4
|
||||
|
||||
DEFAULT_MODEL=gpt-3.5-turbo
|
||||
PRELOAD_MODELS=[{"url":"github:go-skynet/model-gallery/gpt4all-j.yaml","name":"gpt-3.5-turbo"},{"url":"github:go-skynet/model-gallery/stablediffusion.yaml","name":"stablediffusion"}]
|
||||
|
||||
#DEFAULT_MODEL=wizard-lm
|
||||
#PRELOAD_MODELS=[{"url":"github:go-skynet/model-gallery/openllama_7b.yaml","name":"open_llama"}]
|
||||
|
||||
#GALLERIES=[{"name":"model-gallery","url":"github:go-skynet/model-gallery/index.yaml"}]
|
||||
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
models/ggml-gpt4all-j.bin
|
||||
models/gpt4all-chat.tmpl
|
||||
models/open-llama-7b-q4_0.bin
|
||||
models/whisper.yaml
|
||||
models/ggml-whisper-base.bin
|
||||
models/gpt4all-completion.tmpl
|
||||
models/openllama-chat.tmpl
|
||||
models/gpt-3.5-turbo.yaml
|
||||
models/gpt4all-j.yaml
|
||||
models/openllama-completion.tmpl
|
||||
models/wizardlm-13b-v1.1-superhot-8k.ggmlv3.q4_0.bin
|
||||
models/wizard-lm.yaml
|
||||
models/wizard-lm-chat.tmpl
|
||||
models/wizard-lm-completion.tmpl
|
||||
models/wizard_lm.yaml
|
||||
models/open_llama.yaml
|
||||
models/openllama.yaml
|
||||
models/open_llama
|
||||
models/*
|
||||
|
||||
app/bin
|
||||
app/include
|
||||
app/lib
|
||||
app/lib64
|
||||
app/__pycache__
|
||||
app/pyvenv.cfg
|
||||
app/client_secrets_prod.json
|
||||
|
||||
images/*
|
||||
@ -5,4 +5,4 @@ WORKDIR /
|
||||
COPY . .
|
||||
RUN pip3 install -r requirements.txt
|
||||
WORKDIR /app
|
||||
CMD ["gunicorn", "-w", "4", "wsgi:app", "--bind", "0.0.0.0:8000"]
|
||||
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
|
||||
30
app/app.py
30
app/app.py
@ -10,32 +10,8 @@ model = "ggml-gpt4all-j.bin"
|
||||
load_dotenv()
|
||||
host = os.getenv("LOCALAI_HOST")
|
||||
|
||||
############################### KEYCLOAK ###############################
|
||||
# app.config.update({
|
||||
# # PROD ONLY
|
||||
# 'SECRET_KEY': 'créer-un-secret-ici',
|
||||
# 'OIDC_CLIENT_SECRETS': 'client_secrets_prod.json',
|
||||
# 'OIDC_ID_TOKEN_COOKIE_SECURE': False,
|
||||
# 'OIDC_REQUIRE_VERIFIED_EMAIL': False,
|
||||
# 'OIDC_USER_INFO_ENABLED': True,
|
||||
# 'OIDC_OPENID_REALM': 'gregan',
|
||||
# 'OIDC_SCOPES': ['openid', 'email', 'profile'],
|
||||
# 'OIDC_INTROSPECTION_AUTH_METHOD': 'client_secret_post'
|
||||
# })
|
||||
|
||||
# app.config['OVERWRITE_REDIRECT_URI'] = 'https://chat-gpt.domain.tld/oidc_callback'
|
||||
# oidc = OpenIDConnect(app)
|
||||
|
||||
# @app.context_processor
|
||||
# def inject_oidc_user():
|
||||
# if oidc.user_loggedin:
|
||||
# return dict(oidc_user=oidc.user_getfield('email'))
|
||||
# return dict(oidc_user=None)
|
||||
|
||||
|
||||
# CHAT BOT: GPT-TURBO-3.5
|
||||
@app.route("/", methods=("GET", "POST"))
|
||||
# @oidc.require_login
|
||||
def index():
|
||||
|
||||
result = ''
|
||||
@ -60,8 +36,6 @@ def index():
|
||||
response = requests.post(url, json=payload)
|
||||
if response.status_code == 200:
|
||||
result = '<md>' + response.json()['choices'][0]['message']['content'] + '</md>'
|
||||
# print(result)
|
||||
# format_code(result)
|
||||
|
||||
else:
|
||||
result = "Erreur de connection avec l'API"
|
||||
@ -75,7 +49,6 @@ def index():
|
||||
|
||||
# IMAGE GENERATOR: STABLEDIFFUSION
|
||||
@app.route("/image", methods=("GET", "POST"))
|
||||
# @oidc.require_login
|
||||
def image():
|
||||
|
||||
result = ''
|
||||
@ -100,9 +73,6 @@ def image():
|
||||
response = requests.post(url, headers=headers, json=data)
|
||||
|
||||
if response.status_code == 200:
|
||||
########## PROD ONLY ##########
|
||||
# image_url = response.json()['data'][0]['url'].replace("local-ai", "image.domain.tld").replace("http", "https").replace(":8080", "")
|
||||
|
||||
image_url = response.json()['data'][0]['url'].replace("local-ai", "localhost")
|
||||
|
||||
else:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
BIN
app/static/logo.png
Normal file
BIN
app/static/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 611 KiB |
@ -9,7 +9,7 @@
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='main.css') }}" />
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
|
||||
<title>Gregan AI</title>
|
||||
<title>Garage AI</title>
|
||||
|
||||
</head>
|
||||
|
||||
@ -20,11 +20,10 @@
|
||||
<p>Loading ...</p>
|
||||
</div>
|
||||
|
||||
<h3>Gregan AI</h3>
|
||||
<h3>Garage AI</h3>
|
||||
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light jumbotron">
|
||||
<!-- <a class="navbar-brand" href="#">Navbar</a> -->
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
@ -53,7 +52,7 @@
|
||||
<div class="footer">
|
||||
<div class="temps">{{ time }}</div>
|
||||
<div>
|
||||
<img src="{{ url_for('static', filename='logo-4.png') }}" style="max-width: 50%;">
|
||||
<img src="{{ url_for('static', filename='logo.png') }}" style="max-width: 50%;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -4,12 +4,6 @@
|
||||
|
||||
<form action="/" method="post" id="form">
|
||||
<div class="settings">
|
||||
<!-- <label for="model">Sélectionnez un model :</label><br>
|
||||
<select id="model" name="model">
|
||||
{% for e in menu %}
|
||||
<option value={{ e }}>{{ e }}</option>
|
||||
{% endfor %}
|
||||
</select> -->
|
||||
<br>
|
||||
<label for="valeur">Sélectionnez la température :</label>
|
||||
<input type="range" id="valeur" name="temperature" min="0" max="1" step=".1">
|
||||
|
||||
@ -27,7 +27,7 @@ services:
|
||||
container_name: flask-ui
|
||||
restart: always
|
||||
ports:
|
||||
- 8000:8000
|
||||
- 5000:5000
|
||||
depends_on:
|
||||
local-ai:
|
||||
condition: service_healthy
|
||||
|
||||
@ -7,5 +7,4 @@ urllib3==1.26.7
|
||||
Werkzeug==2.0.2
|
||||
gunicorn==21.2.0
|
||||
itsdangerous==2.0.1
|
||||
flask_oidc==1.4.0
|
||||
python-dotenv
|
||||
Loading…
x
Reference in New Issue
Block a user