Image processing
Browse files- Dockerfile +0 -2
- __pycache__/app.cpython-311.pyc +0 -0
- __pycache__/funciones.cpython-311.pyc +0 -0
- app.py +9 -1
- funciones.py +13 -7
Dockerfile
CHANGED
|
@@ -9,5 +9,3 @@ RUN pip install --no-cache-dir -r /code/requirements.txt
|
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 12 |
-
|
| 13 |
-
#CMD ["fastapi", "run"]
|
|
|
|
| 9 |
COPY . .
|
| 10 |
|
| 11 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
__pycache__/funciones.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/funciones.cpython-311.pyc and b/__pycache__/funciones.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -26,4 +26,12 @@ async def echo_image(image: UploadFile = File(...)):
|
|
| 26 |
if not image.content_type.startswith("image/"):
|
| 27 |
return {"error": "El archivo no es una imagen"}
|
| 28 |
contents = await image.read()
|
| 29 |
-
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if not image.content_type.startswith("image/"):
|
| 27 |
return {"error": "El archivo no es una imagen"}
|
| 28 |
contents = await image.read()
|
| 29 |
+
return StreamingResponse(BytesIO(contents), media_type=image.content_type)
|
| 30 |
+
|
| 31 |
+
@app.post(
|
| 32 |
+
"/genera_dni/",
|
| 33 |
+
summary="Procesamiento de DNI")
|
| 34 |
+
async def comidas(image: UploadFile = File(...)):
|
| 35 |
+
if not image.content_type.startswith("image/"):
|
| 36 |
+
return {"error": "El archivo no es una imagen"}
|
| 37 |
+
return funciones.procesa_dni(image)
|
funciones.py
CHANGED
|
@@ -1,9 +1,15 @@
|
|
| 1 |
from gradio_client import Client, handle_file
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from gradio_client import Client, handle_file
|
| 2 |
|
| 3 |
+
def procesa_dni(image):
|
| 4 |
+
|
| 5 |
+
print(image)
|
| 6 |
+
|
| 7 |
+
client = Client("Moibe/api_rapicash")
|
| 8 |
+
result = client.predict(
|
| 9 |
+
img=handle_file('dnid.png'),
|
| 10 |
+
lang="en",
|
| 11 |
+
api_name="/predict"
|
| 12 |
+
)
|
| 13 |
+
print(result)
|
| 14 |
+
|
| 15 |
+
return result
|