Spaces:
Sleeping
Sleeping
Fix: Runtime error
Browse files
app.py
CHANGED
|
@@ -81,6 +81,8 @@ def main():
|
|
| 81 |
global model, classes
|
| 82 |
|
| 83 |
try:
|
|
|
|
|
|
|
| 84 |
# Load the model at startup
|
| 85 |
model = load_model("resnet50_imagenet1k.pth")
|
| 86 |
|
|
@@ -186,19 +188,16 @@ def main():
|
|
| 186 |
label="Click on any example to run GradCAM"
|
| 187 |
)
|
| 188 |
|
| 189 |
-
#
|
| 190 |
-
demo.queue(
|
| 191 |
|
| 192 |
-
# Launch
|
| 193 |
demo.launch(
|
| 194 |
server_name="0.0.0.0",
|
| 195 |
server_port=7860,
|
| 196 |
-
share=False
|
| 197 |
-
debug=True,
|
| 198 |
-
show_error=True,
|
| 199 |
-
max_threads=1, # Reduce concurrent processing
|
| 200 |
-
cache_examples=False # Disable example caching
|
| 201 |
)
|
|
|
|
| 202 |
except Exception as e:
|
| 203 |
print(f"Error during startup: {str(e)}")
|
| 204 |
if torch.cuda.is_available():
|
|
|
|
| 81 |
global model, classes
|
| 82 |
|
| 83 |
try:
|
| 84 |
+
print(f"Gradio version: {gr.__version__}")
|
| 85 |
+
|
| 86 |
# Load the model at startup
|
| 87 |
model = load_model("resnet50_imagenet1k.pth")
|
| 88 |
|
|
|
|
| 188 |
label="Click on any example to run GradCAM"
|
| 189 |
)
|
| 190 |
|
| 191 |
+
# Configure queue
|
| 192 |
+
demo.queue()
|
| 193 |
|
| 194 |
+
# Launch with minimal parameters
|
| 195 |
demo.launch(
|
| 196 |
server_name="0.0.0.0",
|
| 197 |
server_port=7860,
|
| 198 |
+
share=False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
)
|
| 200 |
+
|
| 201 |
except Exception as e:
|
| 202 |
print(f"Error during startup: {str(e)}")
|
| 203 |
if torch.cuda.is_available():
|