Skip to content

Commit

Permalink
Merge pull request #69 from SCAI-BIO/fix-endpoint
Browse files Browse the repository at this point in the history
refactor: use forms for default values
  • Loading branch information
tiadams authored Sep 27, 2024
2 parents b57c6bc + caba2e8 commit 9bba4d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

import uvicorn
from datastew import DataDictionarySource
from datastew.embedding import GPT4Adapter, MPNetAdapter
from datastew.embedding import MPNetAdapter
from datastew.process.ols import OLSTerminologyImportTask
from datastew.repository import WeaviateRepository
from datastew.repository.model import Concept, Mapping, Terminology
from datastew.visualisation import get_plot_for_current_database_state
from fastapi import FastAPI, File, HTTPException, UploadFile
from fastapi import FastAPI, File, HTTPException, UploadFile, Form
from starlette.background import BackgroundTasks
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import HTMLResponse, RedirectResponse
Expand Down Expand Up @@ -219,10 +219,10 @@ async def get_closest_mappings_for_text(text: str,
# Endpoint to get mappings for a data dictionary source
@app.post("/mappings/dict", tags=["mappings"], description="Get mappings for a data dictionary source.")
async def get_closest_mappings_for_dictionary(file: UploadFile = File(...),
model: str = "sentence-transformers/all-mpnet-base-v2",
terminology_name: str = "SNOMED CT",
variable_field: str = "variable",
description_field: str = "description"):
model: str = Form("sentence-transformers/all-mpnet-base-v2"),
terminology_name: str = Form("SNOMED CT"),
variable_field: str = Form("variable"),
description_field: str = Form("description")):
try:
embedding_model = MPNetAdapter(model)
# Determine file extension and create a temporary file with the correct extension
Expand Down

0 comments on commit 9bba4d3

Please sign in to comment.