Update app.py
Browse files
app.py
CHANGED
|
@@ -89,3 +89,22 @@ async def predict(file: UploadFile = File(...)):
|
|
| 89 |
|
| 90 |
except Exception as e:
|
| 91 |
return JSONResponse({"error": str(e)})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
except Exception as e:
|
| 91 |
return JSONResponse({"error": str(e)})
|
| 92 |
+
|
| 93 |
+
import gradio as gr
|
| 94 |
+
import uvicorn
|
| 95 |
+
import threading
|
| 96 |
+
|
| 97 |
+
def run_api():
|
| 98 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
| 99 |
+
|
| 100 |
+
threading.Thread(target=run_api).start()
|
| 101 |
+
|
| 102 |
+
gr.Markdown("""
|
| 103 |
+
# 🌾 Crop Disease Classification API
|
| 104 |
+
|
| 105 |
+
### Endpoint:
|
| 106 |
+
POST `/predict`
|
| 107 |
+
|
| 108 |
+
Use Postman / frontend to send image.
|
| 109 |
+
""").launch(server_name="0.0.0.0", server_port=7860)
|
| 110 |
+
|