Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Scribe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ala
Scribe
Commits
11c74073
Commit
11c74073
authored
9 months ago
by
Julien B.
Browse files
Options
Downloads
Patches
Plain Diff
fix(endpoints): add inferer config endpoint
parent
59374ec1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/models/InfererConfig.py
+6
-0
6 additions, 0 deletions
api/models/InfererConfig.py
api/routers/endpoints.py
+12
-1
12 additions, 1 deletion
api/routers/endpoints.py
with
18 additions
and
1 deletion
api/models/InfererConfig.py
0 → 100644
+
6
−
0
View file @
11c74073
from
pydantic
import
BaseModel
class
InfererConfig
(
BaseModel
):
provider
:
str
model_id
:
str
server_url
:
str
\ No newline at end of file
This diff is collapsed.
Click to expand it.
api/routers/endpoints.py
+
12
−
1
View file @
11c74073
from
fastapi
import
APIRouter
from
api.internal_services
import
database
from
api.internal_services.background_worker
import
add_job_to_queue
from
api.internal_services.logger
import
logger
import
uuid
from
api.models.InfererConfig
import
InfererConfig
from
api.models.Job
import
Job
,
JobType
from
api.models.Sentence
import
Sentence
from
api.models.TrainingBody
import
TrainingBody
...
...
@@ -34,4 +36,13 @@ def add_sentence_to_process(training_body: TrainingBody):
"
huggingface_token
"
:
training_body
.
huggingface_token
,
}
add_job_to_queue
(
new_job
)
return
{
"
message
"
:
"
Job added to the queue for processing.
"
,
"
job_id
"
:
new_job
.
job_id
}
\ No newline at end of file
return
{
"
message
"
:
"
Job added to the queue for processing.
"
,
"
job_id
"
:
new_job
.
job_id
}
@router.post
(
"
/actions/inferer/config
"
)
def
add_sentence_to_process
(
infererConfig
:
InfererConfig
):
new_config
=
{
'
model_id
'
:
infererConfig
.
provider
}
if
infererConfig
.
provider
==
'
BERT
'
:
new_config
[
'
model_id
'
]
=
infererConfig
.
model_id
new_config
[
'
server_url
'
]
=
infererConfig
.
server_url
database
.
update_annotator_config
({
'
model_id
'
:
'
GPT
'
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment