Update app.py
Browse files
app.py
CHANGED
|
@@ -15,17 +15,24 @@ async def buscar(query: str):
|
|
| 15 |
return {"respuesta": results["organic_results"][0]["snippet"]}
|
| 16 |
|
| 17 |
|
| 18 |
-
from fastapi import UploadFile, File
|
| 19 |
from PIL import Image
|
| 20 |
import pytesseract
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
@app.post("/analizar-imagen")
|
| 23 |
-
async def analizar_imagen(imagen: UploadFile = File(...)):
|
| 24 |
img = Image.open(imagen.file)
|
| 25 |
-
texto = pytesseract.image_to_string(img)
|
| 26 |
return {"texto": texto}
|
| 27 |
|
| 28 |
-
|
| 29 |
import firebase_admin
|
| 30 |
from firebase_admin import auth, credentials
|
| 31 |
|
|
|
|
| 15 |
return {"respuesta": results["organic_results"][0]["snippet"]}
|
| 16 |
|
| 17 |
|
| 18 |
+
from fastapi import FastAPI, UploadFile, File # <-- ¡Añade File aquí!
|
| 19 |
from PIL import Image
|
| 20 |
import pytesseract
|
| 21 |
|
| 22 |
+
app = FastAPI()
|
| 23 |
+
|
| 24 |
+
# Endpoint de prueba
|
| 25 |
+
@app.get("/")
|
| 26 |
+
def raiz():
|
| 27 |
+
return {"Mensaje": "¡V3G4 funciona! Creada por 4n0n1m0-117"}
|
| 28 |
+
|
| 29 |
+
# Endpoint para análisis de imágenes
|
| 30 |
@app.post("/analizar-imagen")
|
| 31 |
+
async def analizar_imagen(imagen: UploadFile = File(...)): # <-- File ahora está definido
|
| 32 |
img = Image.open(imagen.file)
|
| 33 |
+
texto = pytesseract.image_to_string(img)
|
| 34 |
return {"texto": texto}
|
| 35 |
|
|
|
|
| 36 |
import firebase_admin
|
| 37 |
from firebase_admin import auth, credentials
|
| 38 |
|