sharktide commited on
Commit
5603fdb
·
1 Parent(s): 323d1c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -5,10 +5,10 @@ from PIL import Image
5
  import cv2 # Make sure OpenCV is available for resizing
6
  from fastapi.responses import JSONResponse
7
  from fastapi.middleware.cors import CORSMiddleware
8
- from slowapi import Limiter
9
- from slowapi import Limiter
10
- from slowapi.util import get_remote_address
11
- from slowapi.errors import RateLimitExceeded
12
 
13
  # Load your trained model
14
  model = tf.keras.models.load_model('recyclebot.keras')
@@ -51,8 +51,8 @@ def preprocess_image(image_file):
51
 
52
 
53
  @app.post("/predict")
54
- @limiter.limit("10/minute")
55
- async def predict(request: Request, file: UploadFile = File(...)):
56
  try:
57
  img_array = preprocess_image(file.file) # Preprocess the image
58
  predictions = model.predict(img_array) # Get predictions
 
5
  import cv2 # Make sure OpenCV is available for resizing
6
  from fastapi.responses import JSONResponse
7
  from fastapi.middleware.cors import CORSMiddleware
8
+ #from slowapi import Limiter
9
+ #from slowapi import Limiter
10
+ #from slowapi.util import get_remote_address
11
+ #from slowapi.errors import RateLimitExceeded
12
 
13
  # Load your trained model
14
  model = tf.keras.models.load_model('recyclebot.keras')
 
51
 
52
 
53
  @app.post("/predict")
54
+ #@limiter.limit("10/minute")
55
+ async def predict(file: UploadFile = File(...)): #async def predict(request: Request, file: UploadFile = File(...)):
56
  try:
57
  img_array = preprocess_image(file.file) # Preprocess the image
58
  predictions = model.predict(img_array) # Get predictions