2020-04-15 14:04:30 +02:00
|
|
|
import logging
|
2021-10-04 11:21:00 +02:00
|
|
|
|
2022-04-12 16:41:05 +02:00
|
|
|
import uvicorn
|
|
|
|
from rest_api.utils import get_app, get_pipelines
|
|
|
|
|
|
|
|
|
2020-04-15 14:04:30 +02:00
|
|
|
logging.basicConfig(format="%(asctime)s %(message)s", datefmt="%m/%d/%Y %I:%M:%S %p")
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
logging.getLogger("elasticsearch").setLevel(logging.WARNING)
|
2021-04-07 17:53:32 +02:00
|
|
|
logging.getLogger("haystack").setLevel(logging.INFO)
|
2020-04-15 14:04:30 +02:00
|
|
|
|
2021-10-04 11:21:00 +02:00
|
|
|
|
2022-04-12 16:41:05 +02:00
|
|
|
app = get_app()
|
|
|
|
pipelines = get_pipelines() # Unused here, called to init the pipelines early
|
2021-10-04 11:21:00 +02:00
|
|
|
|
|
|
|
|
2020-04-15 14:04:30 +02:00
|
|
|
logger.info("Open http://127.0.0.1:8000/docs to see Swagger API Documentation.")
|
|
|
|
logger.info(
|
|
|
|
"""
|
2022-04-12 16:41:05 +02:00
|
|
|
Or just try it out directly: curl --request POST --url 'http://127.0.0.1:8000/query'
|
|
|
|
-H "Content-Type: application/json" --data '{"query": "Who is the father of Arya Stark?"}'
|
2021-07-19 12:57:43 +02:00
|
|
|
"""
|
2020-04-15 14:04:30 +02:00
|
|
|
)
|
|
|
|
|
2022-04-12 16:41:05 +02:00
|
|
|
|
2020-04-15 14:04:30 +02:00
|
|
|
if __name__ == "__main__":
|
|
|
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|