LuisTo97 commited on
Commit
e20fb06
·
verified ·
1 Parent(s): 40a5efb

Upload 3 files

Browse files
Files changed (3) hide show
  1. feedback_log.csv +9 -0
  2. main.py +37 -0
  3. vision_requirements.txt +71 -0
feedback_log.csv ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <<<<<<< HEAD
2
+ version https://git-lfs.github.com/spec/v1
3
+ oid sha256:1cde927c190e51b3ab43ab41753184faf4744bd2aaf373531fb7d6ddbb97df0b
4
+ size 110
5
+ =======
6
+ timestamp,predicted,correct
7
+ 2025-06-23T23:44:19.296391,string,string
8
+ 2025-06-23T23:45:40.228741,string,string
9
+ >>>>>>> 1eb10b28 (Mover greenvision.h5 dentro de api/models)
main.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app/main.py
2
+ import os
3
+ import logging
4
+ from fastapi import FastAPI, UploadFile, File
5
+ from app.model import preprocess_image, CLASS_NAMES, load_model
6
+
7
+ # Configura logging
8
+ logging.basicConfig(level=logging.INFO)
9
+ logger = logging.getLogger(__name__)
10
+
11
+ app = FastAPI()
12
+
13
+ @app.on_event("startup")
14
+ async def startup_event():
15
+ try:
16
+ logger.info("📦 Cargando modelo...")
17
+
18
+ app.state.model = load_model()
19
+ logger.info("✅ Modelo cargado correctamente")
20
+ except Exception as e:
21
+ logger.error(f"Error cargando el modelo: {e}")
22
+ raise
23
+
24
+ @app.get("/")
25
+ async def read_root():
26
+ return {"message": "GreenVision API en marcha"}
27
+
28
+ @app.post("/predict")
29
+ async def predict(file: UploadFile = File(...)):
30
+ try:
31
+ contents = await file.read()
32
+ img = preprocess_image(contents)
33
+ preds = app.state.model.predict(img)
34
+ return {"predictions": preds.tolist(), "labels": CLASS_NAMES}
35
+ except Exception as e:
36
+ logger.error(f"Error en predicción: {e}")
37
+ raise
vision_requirements.txt ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <<<<<<< HEAD
2
+ <<<<<<< HEAD
3
+
4
+ python-multipart==0.0.6
5
+ fastapi==0.115.13
6
+ uvicorn==0.22.0
7
+ requests==2.32.4
8
+ tensorflow==2.15.0
9
+ numpy==1.24.0
10
+ pandas==2.0.3
11
+ scikit-learn==1.2.2
12
+ matplotlib==3.7.1
13
+ plotly==5.18.0
14
+ kaleido==0.2.1
15
+ Pillow==10.4.0
16
+ kaggle==1.5.16
17
+ tqdm==4.65.0
18
+
19
+ =======
20
+ absl-py==2.3.0
21
+ annotated-types==0.7.0
22
+ anyio==4.9.0
23
+ astunparse==1.6.3
24
+ certifi==2025.6.15
25
+ charset-normalizer==3.4.2
26
+ click==8.1.8
27
+ exceptiongroup==1.3.0
28
+ =======
29
+
30
+ python-multipart==0.0.6
31
+ >>>>>>> bc96cbda (Proyecto GreenVision: notebooks, API, frontend y Space listos)
32
+ fastapi==0.115.13
33
+ uvicorn==0.22.0
34
+ requests==2.32.4
35
+ <<<<<<< HEAD
36
+ rich==14.0.0
37
+ six==1.17.0
38
+ sniffio==1.3.1
39
+ starlette==0.46.2
40
+ tensorboard==2.16.2
41
+ tensorboard-data-server==0.7.2
42
+ tensorflow==2.16.2
43
+ tensorflow-io-gcs-filesystem==0.37.1
44
+ tensorflow-macos==2.16.2
45
+ tensorflow-metal==1.2.0
46
+ termcolor==3.1.0
47
+ typing-inspection==0.4.1
48
+ typing_extensions==4.14.0
49
+ tzdata==2025.2
50
+ urllib3==2.5.0
51
+ uvicorn==0.34.3
52
+ uvloop==0.21.0
53
+ watchfiles==1.1.0
54
+ websockets==15.0.1
55
+ Werkzeug==3.1.3
56
+ wrapt==1.17.2
57
+ zipp==3.23.0
58
+ >>>>>>> 1eb10b28 (Mover greenvision.h5 dentro de api/models)
59
+ =======
60
+ tensorflow==2.15.0
61
+ numpy==1.24.0
62
+ pandas==2.0.3
63
+ scikit-learn==1.2.2
64
+ matplotlib==3.7.1
65
+ plotly==5.18.0
66
+ kaleido==0.2.1
67
+ Pillow==10.4.0
68
+ kaggle==1.5.16
69
+ tqdm==4.65.0
70
+
71
+ >>>>>>> bc96cbda (Proyecto GreenVision: notebooks, API, frontend y Space listos)