Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files- myinfer_latest.py +9 -1
myinfer_latest.py
CHANGED
@@ -49,7 +49,15 @@ split_model="htdemucs"
|
|
49 |
convert_voice_lock = Lock()
|
50 |
#concurrent= os.getenv('concurrent', '')
|
51 |
# Define the maximum number of concurrent requests
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
# Initialize the semaphore with the maximum number of concurrent requests
|
55 |
request_semaphore = Semaphore(MAX_CONCURRENT_REQUESTS)
|
|
|
49 |
convert_voice_lock = Lock()
|
50 |
#concurrent= os.getenv('concurrent', '')
|
51 |
# Define the maximum number of concurrent requests
|
52 |
+
|
53 |
+
try:
|
54 |
+
# Try to convert the environment variable to an integer, defaulting to 5 if not set.
|
55 |
+
MAX_CONCURRENT_REQUESTS = int(os.getenv('concurrent', '5'))
|
56 |
+
except ValueError:
|
57 |
+
# If conversion fails, log an error or use a fallback value.
|
58 |
+
print("Warning: Environment variable 'concurrent' is not a valid integer. Using default value of 5.")
|
59 |
+
MAX_CONCURRENT_REQUESTS = 5
|
60 |
+
|
61 |
|
62 |
# Initialize the semaphore with the maximum number of concurrent requests
|
63 |
request_semaphore = Semaphore(MAX_CONCURRENT_REQUESTS)
|