John Landry commited on
Commit
7d02c05
1 Parent(s): 51dd000

added logging

Browse files
Files changed (2) hide show
  1. Docker +0 -14
  2. main.py +7 -1
Docker DELETED
@@ -1,14 +0,0 @@
1
- # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
- FROM python:3.9
5
-
6
- WORKDIR /code
7
-
8
- COPY ./requirements.txt /code/requirements.txt
9
-
10
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
-
12
- COPY . .
13
-
14
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.py CHANGED
@@ -1,8 +1,14 @@
1
  from fastapi import FastAPI
 
 
 
2
 
3
  app = FastAPI()
4
 
5
  @app.get('/hello')
6
  def hello():
 
7
  # add this comment
8
- return {'hello': 'world'}
 
 
 
1
  from fastapi import FastAPI
2
+ import logging
3
+
4
+ logger = logging.getLogger()
5
 
6
  app = FastAPI()
7
 
8
  @app.get('/hello')
9
  def hello():
10
+ logger.info('request to /hello')
11
  # add this comment
12
+ print('hello log')
13
+ return {'hello': 'world'}
14
+