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