Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,22 +35,35 @@ else:
|
|
| 35 |
st.write("Failed to download the file.")
|
| 36 |
|
| 37 |
# Carregar a biblioteca compartilhada usando ctypes
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
-
Synapses_Active
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
ExecuteModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
import keys as key
|
| 56 |
|
|
|
|
| 35 |
st.write("Failed to download the file.")
|
| 36 |
|
| 37 |
# Carregar a biblioteca compartilhada usando ctypes
|
| 38 |
+
try:
|
| 39 |
+
lib = ctypes.CDLL(output_path)
|
| 40 |
+
|
| 41 |
+
# Verificar e definir as funções
|
| 42 |
+
if hasattr(lib, 'Initial_Memory'):
|
| 43 |
+
Initial_Memory = lib.Initial_Memory
|
| 44 |
+
Initial_Memory.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
|
| 45 |
+
Initial_Memory.restype = ctypes.c_void_p
|
| 46 |
+
st.write("Initial_Memory function loaded successfully.")
|
| 47 |
+
else:
|
| 48 |
+
st.write("Initial_Memory function not found in the library.")
|
| 49 |
|
| 50 |
+
if hasattr(lib, 'Synapses_Active'):
|
| 51 |
+
Synapses_Active = lib.Synapses_Active
|
| 52 |
+
Synapses_Active.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
|
| 53 |
+
Synapses_Active.restype = ctypes.c_void_p
|
| 54 |
+
st.write("Synapses_Active function loaded successfully.")
|
| 55 |
+
else:
|
| 56 |
+
st.write("Synapses_Active function not found in the library.")
|
| 57 |
|
| 58 |
+
if hasattr(lib, 'ExecuteModel'):
|
| 59 |
+
ExecuteModel = lib.ExecuteModel
|
| 60 |
+
ExecuteModel.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_void_p]
|
| 61 |
+
ExecuteModel.restype = ctypes.c_char_p
|
| 62 |
+
st.write("ExecuteModel function loaded successfully.")
|
| 63 |
+
else:
|
| 64 |
+
st.write("ExecuteModel function not found in the library.")
|
| 65 |
+
except Exception as e:
|
| 66 |
+
st.write(f"Error loading library: {e}")
|
| 67 |
|
| 68 |
import keys as key
|
| 69 |
|