server : add flag to disable the web-ui (#10762) (#10751)

Co-authored-by: eugenio.segala <esegala@deloitte.co.uk>
This commit is contained in:
Yüg 2024-12-10 17:22:34 +00:00 committed by GitHub
parent a05e2afcc2
commit a86ad841f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 46 additions and 13 deletions

View file

@ -1,4 +1,5 @@
import pytest
import requests
from utils import *
server = ServerPreset.tinyllama2()
@ -76,3 +77,20 @@ def test_load_split_model():
})
assert res.status_code == 200
assert match_regex("(little|girl)+", res.body["content"])
def test_no_webui():
global server
# default: webui enabled
server.start()
url = f"http://{server.server_host}:{server.server_port}"
res = requests.get(url)
assert res.status_code == 200
assert "<html>" in res.text
server.stop()
# with --no-webui
server.no_webui = True
server.start()
res = requests.get(url)
assert res.status_code == 404