Spaces:
Runtime error
Runtime error
Commit ·
f766440
1
Parent(s): fc4bdb9
Fix: Convert alt_model_path to Path object
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ import subprocess
|
|
| 6 |
import ssl
|
| 7 |
import threading
|
| 8 |
import functools
|
|
|
|
| 9 |
from flask import Flask, request, jsonify
|
| 10 |
from flask_cors import CORS
|
| 11 |
from werkzeug.utils import secure_filename
|
|
@@ -31,7 +32,7 @@ import torch
|
|
| 31 |
print("Preloading Allosaurus model...")
|
| 32 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 33 |
print(f"Using device: {device}")
|
| 34 |
-
MODEL = read_recognizer(alt_model_path="/tmp/allosaurus_models")
|
| 35 |
if device == 'cuda':
|
| 36 |
MODEL.model.to(device)
|
| 37 |
|
|
|
|
| 6 |
import ssl
|
| 7 |
import threading
|
| 8 |
import functools
|
| 9 |
+
from pathlib import Path
|
| 10 |
from flask import Flask, request, jsonify
|
| 11 |
from flask_cors import CORS
|
| 12 |
from werkzeug.utils import secure_filename
|
|
|
|
| 32 |
print("Preloading Allosaurus model...")
|
| 33 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 34 |
print(f"Using device: {device}")
|
| 35 |
+
MODEL = read_recognizer(alt_model_path=Path("/tmp/allosaurus_models"))
|
| 36 |
if device == 'cuda':
|
| 37 |
MODEL.model.to(device)
|
| 38 |
|