Spaces:
Runtime error
Runtime error
Download app.py from Myloiose/pythonImages: direct link, hf CLI and curl.
- Browser
- Download file 436 Bytes
-
https://huggingface.co/spaces/Myloiose/pythonImages/resolve/main/app.py
- Command line
-
hf download hf://spaces/Myloiose/pythonImages/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Myloiose/pythonImages/resolve/main/app.py
436 Bytes
| from fastapi import FastAPI, File, UploadFile | |
| from gradio_client import Client, handle_file | |
| app = FastAPI() | |
| client = Client("Myloiose/mobilenetv1-tflite-demo") | |
| async def predict(file: UploadFile = File(...)): | |
| tmp = f"/tmp/{file.filename}" | |
| with open(tmp, "wb") as f: | |
| f.write(await file.read()) | |
| result = client.predict(image=handle_file(tmp), api_name="/predict") | |
| return {"result": result} | |