Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
naifu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
naifu
Commits
628ff463
Commit
628ff463
authored
Oct 17, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add build with frontend
parent
9f24db3c
Pipeline
#17222
canceled with stages
in 12 minutes and 47 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
9 deletions
+41
-9
.dockerignore
.dockerignore
+1
-1
.gitlab-ci.yml
.gitlab-ci.yml
+20
-1
Dockerfile.full
Dockerfile.full
+10
-0
docker-compose.yml
docker-compose.yml
+2
-0
main.py
main.py
+8
-7
No files found.
.dockerignore
View file @
628ff463
.git*
__pycache__
.dockerignore
Dockerfile
Dockerfile
*
/*.bat
/*.sh
/models
...
...
.gitlab-ci.yml
View file @
628ff463
stages
:
-
build
-
build2
-
deploy
variables
:
GIT_DEPTH
:
"
1"
...
...
@@ -13,13 +14,22 @@ before_script:
-
docker build --pull -t $TARGET_IMAGE .
-
docker push $TARGET_IMAGE
build
-x86
:
build
:
extends
:
.build-image
tags
:
-
docker
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
build_full
:
extends
:
.build-image
stage
:
build2
script
:
-
docker build --pull --build-arg BASE=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -f Dockerfile.full -t $TARGET_IMAGE .
-
docker push $TARGET_IMAGE
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-full
.deploy
:
stage
:
deploy
tags
:
...
...
@@ -32,6 +42,15 @@ build-x86:
deploy_latest
:
extends
:
.deploy
variables
:
FROM_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:latest
only
:
-
master
deploy_full
:
extends
:
.deploy
variables
:
FROM_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-full
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$full
only
:
-
master
Dockerfile.full
0 → 100644
View file @
628ff463
ARG BASE=git-registry.mycard.moe/novelai-storage/naifu:latest
FROM node:lts-bullseye as frontend
RUN apt update && apt -y install git && npm install -g pnpm && \
git clone https://code.mycard.moe/novelai-storage/naifu-frontend.git /frontend && \
cd /frontend && pnpm install && pnpm run build
FROM $BASE
COPY --from=frontend /frontend/build ./static
ENV WITH_STATIC=1
docker-compose.yml
View file @
628ff463
...
...
@@ -8,6 +8,8 @@ services:
-
./models:/app/models
-
./main.py:/app/main.py:ro
-
./hydra_node:/app/hydra_node:ro
-
./static:/app/static:ro
environment
:
# TOKEN_SERVER: https://api.moecube.com/accounts/authUser
TOKEN
:
mycard
WITH_STATIC
:
1
main.py
View file @
628ff463
...
...
@@ -6,8 +6,8 @@ from pydantic import BaseModel
from
fastapi.responses
import
HTMLResponse
,
PlainTextResponse
,
Response
from
fastapi.exceptions
import
HTTPException
from
fastapi.middleware.cors
import
CORSMiddleware
#
from fastapi.staticfiles import StaticFiles
#
from starlette.responses import FileResponse
from
fastapi.staticfiles
import
StaticFiles
from
starlette.responses
import
FileResponse
from
hydra_node.config
import
init_config_model
from
hydra_node.models
import
EmbedderModel
from
typing
import
Optional
,
List
...
...
@@ -316,7 +316,7 @@ def generate_text(request: TextRequest, authorized: bool = Depends(verify_token)
return
ErrorOutput
(
error
=
str
(
e
))
@
app
.
get
(
'/predict-tags'
,
response_model
=
Union
[
TagOutput
,
ErrorOutput
])
async
def
predict_tags
(
prompt
=
""
,
authorized
:
bool
=
Depends
(
verify_token
)):
async
def
predict_tags
(
prompt
=
""
):
#
, authorized: bool = Depends(verify_token)):
t
=
time
.
perf_counter
()
try
:
#output = sanitize_input(config, request)
...
...
@@ -342,11 +342,12 @@ async def predict_tags(prompt="", authorized: bool = Depends(verify_token)):
os
.
kill
(
mainpid
,
signal
.
SIGTERM
)
return
ErrorOutput
(
error
=
str
(
e
))
#@app.get('/')
#def index():
# return FileResponse('static/index.html')
if
os
.
getenv
(
"WITH_STATIC"
,
None
):
@
app
.
get
(
'/'
)
def
index
():
return
FileResponse
(
'static/index.html'
)
#
app.mount("/", StaticFiles(directory="static/"), name="static")
app
.
mount
(
"/"
,
StaticFiles
(
directory
=
"static/"
),
name
=
"static"
)
if
__name__
==
"__main__"
:
uvicorn
.
run
(
"main:app"
,
host
=
"0.0.0.0"
,
port
=
4315
,
log_level
=
"info"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment