Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,8 +6,13 @@ import requests
|
|
| 6 |
import io
|
| 7 |
import base64
|
| 8 |
|
|
|
|
| 9 |
app = FastAPI()
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
@app.get("/detect-objects", response_class=HTMLResponse)
|
| 12 |
def detect_objects(url: str):
|
| 13 |
try:
|
|
|
|
| 6 |
import io
|
| 7 |
import base64
|
| 8 |
|
| 9 |
+
# Create a new FastAPI app instance
|
| 10 |
app = FastAPI()
|
| 11 |
|
| 12 |
+
# Initialize the Yolos model and image processor
|
| 13 |
+
yolos_model = YolosForObjectDetection.from_pretrained('hustvl/yolos-tiny')
|
| 14 |
+
yolos_image_processor = YolosImageProcessor.from_pretrained("hustvl/yolos-tiny")
|
| 15 |
+
|
| 16 |
@app.get("/detect-objects", response_class=HTMLResponse)
|
| 17 |
def detect_objects(url: str):
|
| 18 |
try:
|