Update app.py
Browse files
app.py
CHANGED
|
@@ -217,11 +217,25 @@ with gr.Blocks(title=title, css=css, theme=theme) as demo:
|
|
| 217 |
api_name="predict",
|
| 218 |
)
|
| 219 |
|
| 220 |
-
#
|
| 221 |
-
#
|
| 222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
|
| 224 |
-
# NEW (Gradio 4.x+)
|
| 225 |
-
demo.queue() # no args here anymore
|
| 226 |
-
demo.launch(share=False, concurrency_count=1, max_threads=1, max_queue_size=4)
|
| 227 |
|
|
|
|
| 217 |
api_name="predict",
|
| 218 |
)
|
| 219 |
|
| 220 |
+
# Version-agnostic Gradio startup (works across 3.x/4.x/5.x)
|
| 221 |
+
# Try newer/older signatures, fall back gracefully.
|
| 222 |
+
|
| 223 |
+
# Queue (GPU scheduling needed on Spaces)
|
| 224 |
+
try:
|
| 225 |
+
demo.queue(concurrency_count=1, max_size=4)
|
| 226 |
+
except TypeError:
|
| 227 |
+
try:
|
| 228 |
+
demo.queue(max_size=4)
|
| 229 |
+
except TypeError:
|
| 230 |
+
demo.queue()
|
| 231 |
+
|
| 232 |
+
# Launch
|
| 233 |
+
try:
|
| 234 |
+
demo.launch(share=False, max_threads=1, max_queue_size=4)
|
| 235 |
+
except TypeError:
|
| 236 |
+
try:
|
| 237 |
+
demo.launch(share=False, max_queue_size=4)
|
| 238 |
+
except TypeError:
|
| 239 |
+
demo.launch(share=False)
|
| 240 |
|
|
|
|
|
|
|
|
|
|
| 241 |
|