Spaces:
Runtime error
Runtime error
migrate: GCP to Hugging Face
Browse files- alembic/env.py +2 -2
- {app β api}/__init__.py +0 -0
- {app β api}/config.py +0 -0
- {app β api}/database.py +0 -0
- {app β api}/gcs.py +0 -0
- api/main.py +71 -0
- {app β api}/models.py +0 -0
- {app β api}/oauth2.py +0 -0
- {app β api}/routers/auth.py +2 -2
- {app β api}/routers/disease_detection.py +3 -3
- {app β api}/routers/doctor.py +3 -3
- {app β api}/routers/pet.py +3 -3
- {app β api}/routers/upload.py +1 -1
- {app β api}/routers/user.py +0 -0
- {app β api}/schemas.py +0 -0
- {app β api}/utils.py +0 -0
- app.py +2 -2
- app/main.py +0 -71
alembic/env.py
CHANGED
@@ -5,8 +5,8 @@ from sqlalchemy import pool
|
|
5 |
|
6 |
from alembic import context
|
7 |
|
8 |
-
from
|
9 |
-
from
|
10 |
|
11 |
# this is the Alembic Config object, which provides
|
12 |
# access to the values within the .ini file in use.
|
|
|
5 |
|
6 |
from alembic import context
|
7 |
|
8 |
+
from api.config import settings
|
9 |
+
from api.models import Base
|
10 |
|
11 |
# this is the Alembic Config object, which provides
|
12 |
# access to the values within the .ini file in use.
|
{app β api}/__init__.py
RENAMED
File without changes
|
{app β api}/config.py
RENAMED
File without changes
|
{app β api}/database.py
RENAMED
File without changes
|
{app β api}/gcs.py
RENAMED
File without changes
|
api/main.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# from fastapi import FastAPI
|
2 |
+
# from api.config import settings
|
3 |
+
# from fastapi.responses import RedirectResponse
|
4 |
+
# from fastapi.middleware.cors import CORSMiddleware
|
5 |
+
# from api.routers import user, auth, upload, pet, disease_detection, doctor
|
6 |
+
|
7 |
+
# app = FastAPI()
|
8 |
+
|
9 |
+
# origins = [
|
10 |
+
# settings.CLIENT_ORIGIN,
|
11 |
+
# ]
|
12 |
+
|
13 |
+
# app.add_middleware(
|
14 |
+
# middleware_class = CORSMiddleware,
|
15 |
+
# allow_origins = ["*"],
|
16 |
+
# allow_methods = ["*"],
|
17 |
+
# allow_headers = ["*"],
|
18 |
+
# allow_credentials = True
|
19 |
+
# )
|
20 |
+
|
21 |
+
# # Auth Routes Group
|
22 |
+
# app.include_router(
|
23 |
+
# tags = ['Auth'],
|
24 |
+
# router = auth.router,
|
25 |
+
# prefix = '/api/auth'
|
26 |
+
# )
|
27 |
+
|
28 |
+
# # User Routes Group
|
29 |
+
# app.include_router(
|
30 |
+
# tags = ['Users'],
|
31 |
+
# router = user.router,
|
32 |
+
# prefix = '/api/users'
|
33 |
+
# )
|
34 |
+
|
35 |
+
# # Upload Routes Group
|
36 |
+
# app.include_router(
|
37 |
+
# tags = ['Upload'],
|
38 |
+
# router = upload.router,
|
39 |
+
# prefix = '/api/upload'
|
40 |
+
# )
|
41 |
+
|
42 |
+
# # Pet Routes Group
|
43 |
+
# app.include_router(
|
44 |
+
# tags = ['Pets'],
|
45 |
+
# router = pet.router,
|
46 |
+
# prefix = '/api/pets'
|
47 |
+
# )
|
48 |
+
|
49 |
+
# # Doctor Routes Group
|
50 |
+
# app.include_router(
|
51 |
+
# tags = ['Doctors'],
|
52 |
+
# router = doctor.router,
|
53 |
+
# prefix = '/api/doctors'
|
54 |
+
# )
|
55 |
+
|
56 |
+
# # Disease Detection Routes Group
|
57 |
+
# app.include_router(
|
58 |
+
# tags = ['Disease Detection'],
|
59 |
+
# router = disease_detection.router,
|
60 |
+
# prefix = '/api/disease_detection'
|
61 |
+
# )
|
62 |
+
|
63 |
+
# # Main Routes Group
|
64 |
+
# @app.get('/api/checker', tags = ['Main'])
|
65 |
+
# def checker():
|
66 |
+
# return {'message': 'Hello Docpet!'}
|
67 |
+
|
68 |
+
# @app.get("/", tags = ['Main'])
|
69 |
+
# def root():
|
70 |
+
# return RedirectResponse(url="/docs")
|
71 |
+
|
{app β api}/models.py
RENAMED
File without changes
|
{app β api}/oauth2.py
RENAMED
File without changes
|
{app β api}/routers/auth.py
RENAMED
@@ -2,11 +2,11 @@ from datetime import timedelta
|
|
2 |
from fastapi import APIRouter, Request, Response, status, Depends, HTTPException
|
3 |
from pydantic import EmailStr
|
4 |
|
5 |
-
from
|
6 |
from .. import schemas, models, utils
|
7 |
from sqlalchemy.orm import Session
|
8 |
from ..database import get_db
|
9 |
-
from
|
10 |
from ..config import settings
|
11 |
|
12 |
router = APIRouter()
|
|
|
2 |
from fastapi import APIRouter, Request, Response, status, Depends, HTTPException
|
3 |
from pydantic import EmailStr
|
4 |
|
5 |
+
from api import oauth2
|
6 |
from .. import schemas, models, utils
|
7 |
from sqlalchemy.orm import Session
|
8 |
from ..database import get_db
|
9 |
+
from api.oauth2 import AuthJWT
|
10 |
from ..config import settings
|
11 |
|
12 |
router = APIRouter()
|
{app β api}/routers/disease_detection.py
RENAMED
@@ -3,9 +3,9 @@ import time
|
|
3 |
import string
|
4 |
import secrets
|
5 |
from http import HTTPStatus
|
6 |
-
from
|
7 |
-
from
|
8 |
-
from
|
9 |
from fastapi.responses import JSONResponse
|
10 |
from fastapi import UploadFile, File, Depends, APIRouter
|
11 |
|
|
|
3 |
import string
|
4 |
import secrets
|
5 |
from http import HTTPStatus
|
6 |
+
from api.gcs import upload_blob
|
7 |
+
from api.oauth2 import require_user
|
8 |
+
from api.utils import image_prediction
|
9 |
from fastapi.responses import JSONResponse
|
10 |
from fastapi import UploadFile, File, Depends, APIRouter
|
11 |
|
{app β api}/routers/doctor.py
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import uuid
|
2 |
from fastapi import APIRouter, HTTPException
|
3 |
-
from
|
4 |
-
from
|
5 |
-
from
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
|
|
1 |
import uuid
|
2 |
from fastapi import APIRouter, HTTPException
|
3 |
+
from api.schemas import CreateDoctorSchema, UpdateDoctorSchema, DoctorResponse
|
4 |
+
from api.models import Doctor
|
5 |
+
from api.database import SessionLocal
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
{app β api}/routers/pet.py
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
import uuid
|
2 |
from fastapi import APIRouter, HTTPException
|
3 |
-
from
|
4 |
-
from
|
5 |
-
from
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
|
|
1 |
import uuid
|
2 |
from fastapi import APIRouter, HTTPException
|
3 |
+
from api.schemas import CreatePetSchema, UpdatePetSchema
|
4 |
+
from api.models import Pet
|
5 |
+
from api.database import SessionLocal
|
6 |
|
7 |
router = APIRouter()
|
8 |
|
{app β api}/routers/upload.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1 |
from fastapi import UploadFile, File, APIRouter
|
2 |
-
from
|
3 |
import os
|
4 |
|
5 |
router = APIRouter()
|
|
|
1 |
from fastapi import UploadFile, File, APIRouter
|
2 |
+
from api.gcs import upload_blob
|
3 |
import os
|
4 |
|
5 |
router = APIRouter()
|
{app β api}/routers/user.py
RENAMED
File without changes
|
{app β api}/schemas.py
RENAMED
File without changes
|
{app β api}/utils.py
RENAMED
File without changes
|
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
-
from
|
3 |
from fastapi.responses import RedirectResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
-
from
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from api.config import settings
|
3 |
from fastapi.responses import RedirectResponse
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
+
from api.routers import user, auth, upload, pet, disease_detection, doctor
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
app/main.py
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
from fastapi import FastAPI
|
2 |
-
from app.config import settings
|
3 |
-
from fastapi.responses import RedirectResponse
|
4 |
-
from fastapi.middleware.cors import CORSMiddleware
|
5 |
-
from app.routers import user, auth, upload, pet, disease_detection, doctor
|
6 |
-
|
7 |
-
app = FastAPI()
|
8 |
-
|
9 |
-
origins = [
|
10 |
-
settings.CLIENT_ORIGIN,
|
11 |
-
]
|
12 |
-
|
13 |
-
app.add_middleware(
|
14 |
-
middleware_class = CORSMiddleware,
|
15 |
-
allow_origins = ["*"],
|
16 |
-
allow_methods = ["*"],
|
17 |
-
allow_headers = ["*"],
|
18 |
-
allow_credentials = True
|
19 |
-
)
|
20 |
-
|
21 |
-
# Auth Routes Group
|
22 |
-
app.include_router(
|
23 |
-
tags = ['Auth'],
|
24 |
-
router = auth.router,
|
25 |
-
prefix = '/api/auth'
|
26 |
-
)
|
27 |
-
|
28 |
-
# User Routes Group
|
29 |
-
app.include_router(
|
30 |
-
tags = ['Users'],
|
31 |
-
router = user.router,
|
32 |
-
prefix = '/api/users'
|
33 |
-
)
|
34 |
-
|
35 |
-
# Upload Routes Group
|
36 |
-
app.include_router(
|
37 |
-
tags = ['Upload'],
|
38 |
-
router = upload.router,
|
39 |
-
prefix = '/api/upload'
|
40 |
-
)
|
41 |
-
|
42 |
-
# Pet Routes Group
|
43 |
-
app.include_router(
|
44 |
-
tags = ['Pets'],
|
45 |
-
router = pet.router,
|
46 |
-
prefix = '/api/pets'
|
47 |
-
)
|
48 |
-
|
49 |
-
# Doctor Routes Group
|
50 |
-
app.include_router(
|
51 |
-
tags = ['Doctors'],
|
52 |
-
router = doctor.router,
|
53 |
-
prefix = '/api/doctors'
|
54 |
-
)
|
55 |
-
|
56 |
-
# Disease Detection Routes Group
|
57 |
-
app.include_router(
|
58 |
-
tags = ['Disease Detection'],
|
59 |
-
router = disease_detection.router,
|
60 |
-
prefix = '/api/disease_detection'
|
61 |
-
)
|
62 |
-
|
63 |
-
# Main Routes Group
|
64 |
-
@app.get('/api/checker', tags = ['Main'])
|
65 |
-
def checker():
|
66 |
-
return {'message': 'Hello Docpet!'}
|
67 |
-
|
68 |
-
@app.get("/", tags = ['Main'])
|
69 |
-
def root():
|
70 |
-
return RedirectResponse(url="/docs")
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|