File size: 1,860 Bytes
fb20323
c515a76
4deaf98
 
62a5014
2ed3649
 
225f963
2ed3649
225f963
2ed3649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4deaf98
2ed3649
 
 
 
 
 
4deaf98
 
7ca50c9
8c92945
 
 
 
 
7ca50c9
2ed3649
8c92945
c515a76
4deaf98
c515a76
 
2ed3649
c515a76
7ca50c9
d7b206b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import sys
import requests
import importlib.util
import streamlit as st

def download_so():
    url = "https://github.com/AlineIoste/teste/raw/main/SynapseControl.cpython-310-x86_64-linux-gnu.so"
    current_dir = os.path.dirname(os.path.abspath(__file__))
    output_path = os.path.join(current_dir, "SynapseControl.cpython-310-x86_64-linux-gnu.so")

    if not os.path.exists(output_path):
        response = requests.get(url)
        response.raise_for_status()  # Para garantir que o download foi bem-sucedido

        with open(output_path, 'wb') as f:
            f.write(response.content)

        st.write(f"Downloaded {url} to {output_path}")
    else:
        st.write(f"File already exists at {output_path}")

# Execute o download
download_so()

# Verifique se o arquivo foi baixado corretamente
current_dir = os.path.dirname(os.path.abspath(__file__))
output_path = os.path.join(current_dir, "SynapseControl.cpython-310-x86_64-linux-gnu.so")

if os.path.exists(output_path):
    st.write("File downloaded successfully.")
else:
    st.write("Failed to download the file.")

# Adicione o diret贸rio dos m贸dulos ao PYTHONPATH
sys.path.append(current_dir)

# Carregar o m贸dulo SynapseControl usando importlib.util
module_name = "SynapseControl"
spec = importlib.util.spec_from_file_location(module_name, output_path)
SynapseControl = importlib.util.module_from_spec(spec)
sys.modules[module_name] = SynapseControl

try:
    spec.loader.exec_module(SynapseControl)
    st.write("SynapseControl module loaded successfully.")
    st.write(dir(SynapseControl))  # Listar os atributos e m茅todos do m贸dulo para verificar se tudo est谩 carregado corretamente
except Exception as e:
    st.write(f"Error loading SynapseControl module: {e}")

# Continue com o restante da l贸gica do seu aplicativo Streamlit
st.title("Neurocognitive Structures")