AlineIoste commited on
Commit
4deaf98
verified
1 Parent(s): c98e67e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -20
app.py CHANGED
@@ -1,7 +1,7 @@
1
- import requests
2
  import os
3
- import importlib.util
4
  import sys
 
 
5
  import streamlit as st
6
 
7
  def download_so():
@@ -25,22 +25,15 @@ download_so()
25
 
26
  # Verifique se o arquivo foi baixado corretamente
27
  current_dir = os.path.dirname(os.path.abspath(__file__))
28
- output_path = os.path.join(current_dir, "SynapseControl.cpython-38-x86_64-linux-gnu.so")
29
 
30
  if os.path.exists(output_path):
31
  st.write("File downloaded successfully.")
32
  else:
33
  st.write("Failed to download the file.")
34
 
35
- # Verificar se todos os m贸dulos Python necess谩rios est茫o dispon铆veis
36
- try:
37
- import LongTermMemory
38
- import ShortTermMemory
39
- import SynapseControl as SC_Py
40
- import Criptografia
41
- st.write("Todos os m贸dulos Python foram importados com sucesso.")
42
- except ModuleNotFoundError as e:
43
- st.write(f"Erro ao importar m贸dulo: {e}")
44
 
45
  # Carregar o m贸dulo SynapseControl usando importlib.util
46
  module_name = "SynapseControl"
@@ -51,14 +44,7 @@ sys.modules[module_name] = SynapseControl
51
  try:
52
  spec.loader.exec_module(SynapseControl)
53
  st.write("SynapseControl module loaded successfully.")
54
-
55
- # Verificar a exist锚ncia das fun莽玫es
56
- functions = ["Initial_Memory", "Synapses_Active", "ExecuteModel"]
57
- for func in functions:
58
- if hasattr(SynapseControl, func):
59
- st.write(f"{func} function is available.")
60
- else:
61
- st.write(f"{func} function is not found in the module.")
62
  except Exception as e:
63
  st.write(f"Error loading SynapseControl module: {e}")
64
 
 
 
1
  import os
 
2
  import sys
3
+ import requests
4
+ import importlib.util
5
  import streamlit as st
6
 
7
  def download_so():
 
25
 
26
  # Verifique se o arquivo foi baixado corretamente
27
  current_dir = os.path.dirname(os.path.abspath(__file__))
28
+ output_path = os.path.join(current_dir, "SynapseControl.cpython-310-x86_64-linux-gnu.so")
29
 
30
  if os.path.exists(output_path):
31
  st.write("File downloaded successfully.")
32
  else:
33
  st.write("Failed to download the file.")
34
 
35
+ # Adicione o diret贸rio dos m贸dulos ao PYTHONPATH
36
+ sys.path.append(current_dir)
 
 
 
 
 
 
 
37
 
38
  # Carregar o m贸dulo SynapseControl usando importlib.util
39
  module_name = "SynapseControl"
 
44
  try:
45
  spec.loader.exec_module(SynapseControl)
46
  st.write("SynapseControl module loaded successfully.")
47
+ st.write(dir(SynapseControl)) # Listar os atributos e m茅todos do m贸dulo para verificar se tudo est谩 carregado corretamente
 
 
 
 
 
 
 
48
  except Exception as e:
49
  st.write(f"Error loading SynapseControl module: {e}")
50