Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,21 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
st.stop() # Stop the execution of the script
|
| 9 |
|
|
|
|
|
|
|
| 10 |
# architecture
|
| 11 |
class AddModel(nn.Module):
|
| 12 |
def __init__(self):
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
+
|
| 4 |
+
# Function to safely import a module
|
| 5 |
+
def safe_import(module_name):
|
| 6 |
+
try:
|
| 7 |
+
return __import__(module_name)
|
| 8 |
+
except ImportError:
|
| 9 |
+
return None
|
| 10 |
+
|
| 11 |
+
# Try to import torch and other dependencies
|
| 12 |
+
torch = safe_import('torch')
|
| 13 |
+
if torch is None:
|
| 14 |
+
st.error("Torch is not installed yet. Please wait a moment for the dependencies to install.")
|
| 15 |
st.stop() # Stop the execution of the script
|
| 16 |
|
| 17 |
+
# Import nn from torch
|
| 18 |
+
import torch.nn as nn
|
| 19 |
# architecture
|
| 20 |
class AddModel(nn.Module):
|
| 21 |
def __init__(self):
|