esteele commited on
Commit
b6a008f
·
1 Parent(s): b29b162

add swagger and redocly

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app/main.py +11 -3
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM ubuntu:latest
2
  LABEL authors="Carla"
3
- FROM python:3.13
4
 
5
  # Set up a new user named "user" with user ID 1000
6
  RUN useradd -m -u 1000 user
 
1
  FROM ubuntu:latest
2
  LABEL authors="Carla"
3
+ FROM python:3.13-slim
4
 
5
  # Set up a new user named "user" with user ID 1000
6
  RUN useradd -m -u 1000 user
app/main.py CHANGED
@@ -3,12 +3,19 @@ from starlette.middleware.cors import CORSMiddleware
3
 
4
  from .api.v1 import upload, captions
5
 
6
- app = FastAPI(title="AI Meme Generator")
 
 
 
 
 
7
 
8
  # Register routes
9
 
10
  app.include_router(upload.router, prefix="/api/v1", tags=["upload"])
11
  app.include_router(captions.router, prefix="/api/v1", tags=["captions"])
 
 
12
  @app.get("/")
13
  async def read_root():
14
  return {"message": "AI Meme Generator is running 🚀"}
@@ -17,8 +24,9 @@ async def read_root():
17
  # ✅ Enable CORS so frontend can talk to backend
18
  app.add_middleware(
19
  CORSMiddleware,
20
- allow_origins=['http://localhost:3000'],
 
21
  allow_credentials=True,
22
  allow_methods=["*"],
23
  allow_headers=["*"],
24
- )
 
3
 
4
  from .api.v1 import upload, captions
5
 
6
+ app = FastAPI(
7
+ title="AI Meme Generator",
8
+ description="Upload images and get funny meme captions",
9
+ docs_url="/swagger", # Swagger UI at /swagger
10
+ redoc_url="/redocly" # ReDoc at /redocly
11
+ )
12
 
13
  # Register routes
14
 
15
  app.include_router(upload.router, prefix="/api/v1", tags=["upload"])
16
  app.include_router(captions.router, prefix="/api/v1", tags=["captions"])
17
+
18
+
19
  @app.get("/")
20
  async def read_root():
21
  return {"message": "AI Meme Generator is running 🚀"}
 
24
  # ✅ Enable CORS so frontend can talk to backend
25
  app.add_middleware(
26
  CORSMiddleware,
27
+ # allow_origins=['http://localhost:3000'],
28
+ allow_origins=['*'],
29
  allow_credentials=True,
30
  allow_methods=["*"],
31
  allow_headers=["*"],
32
+ )