Moibe commited on
Commit
c2ff93d
·
1 Parent(s): 418a5a3

Image processing

Browse files
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
- client = Client("Moibe/api_rapicash")
4
- result = client.predict(
5
- img=handle_file('dnid.png'),
6
- lang="en",
7
- api_name="/predict"
8
- )
9
- print(result)
 
 
 
 
 
 
 
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