Skip to content
Snippets Groups Projects
Commit d7642645 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Ignore pycache files

parent 9d130294
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,8 @@ from pathlib import Path
from fastapi import FastAPI, HTTPException
from session import Session
from workflow import infer_image_to_image
from model_server.session import Session
from model_server.workflow import infer_image_to_image
app = FastAPI()
session = Session()
......@@ -14,7 +14,7 @@ def startup():
@app.get('/')
def read_root():
return {'test': 'success'}
return {'success': True}
@app.get('/models')
def list_active_models():
......@@ -27,9 +27,6 @@ def load_model(model_id: str, project_file: Path) -> Path: # does API autoencode
status_code=409,
detail=f'Model with id {model_id} has already been loaded'
)
# model = new_ilastik_shell
# session.models[model_id] = model
pass
@app.post('/i2i/infer/{model_id}') # image file in, image file out
def infer_img(model_id: str, imgf: str, channel: int = None) -> dict:
......
from multiprocessing import Process
import requests
import unittest
import uvicorn
class TestApiFromAutomatedClient(unittest.TestCase):
def setUp(self) -> None:
import uvicorn
host = '127.0.0.1'
port = 5000
self.server_process = Process(
target=uvicorn.run,
args=('api:app', ),
kwargs={'host': host, 'port': port, 'log_level': 'info'},
daemon=True
)
self.uri = f'http://{host}:{port}/'
self.server_process.start()
def tearDown(self) -> None:
self.server_process.terminate()
def test_trivial_api_response(self):
resp = requests.get(self.uri, )
self.assertEqual(resp.status_code, 200)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment