Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,6 @@ import numpy as np
|
|
8 |
from torch.optim import Adam
|
9 |
from torch.utils.data import DataLoader, TensorDataset
|
10 |
|
11 |
-
# Define all models
|
12 |
class GA(nn.Module):
|
13 |
def __init__(self, input_dim, output_dim):
|
14 |
super(GA, self).__init__()
|
@@ -70,7 +69,6 @@ class PhiModel(nn.Module):
|
|
70 |
def forward(self, x):
|
71 |
return torch.sigmoid(self.linear(x))
|
72 |
|
73 |
-
# Initialize models
|
74 |
ga_model = GA(128, 64)
|
75 |
snn_model = SNN(128, 64, 32)
|
76 |
rnn_model = RNN(128, 64, 32)
|
@@ -78,22 +76,19 @@ nn_model = NN(128, 64, 32)
|
|
78 |
cnn_model = CNN(1, 32)
|
79 |
phi_model = PhiModel(128)
|
80 |
|
81 |
-
#
|
82 |
-
dummy_input = torch.rand(1, 1, 16, 16) # Matches CNN input shape
|
83 |
|
84 |
def iit_consciousness_processing(dummy_input):
|
85 |
-
# Flatten for models expecting a 1D tensor
|
86 |
flat_input = dummy_input.view(1, -1)
|
87 |
|
88 |
-
# Get outputs from all models
|
89 |
ga_output = ga_model(flat_input)
|
90 |
snn_output = snn_model(flat_input)
|
91 |
-
rnn_output = rnn_model(flat_input.unsqueeze(1))
|
92 |
nn_output = nn_model(flat_input)
|
93 |
-
|
|
|
94 |
phi_output = phi_model(flat_input)
|
95 |
|
96 |
-
# Compute consciousness score
|
97 |
consciousness_score = (
|
98 |
0.2 * ga_output.mean() +
|
99 |
0.2 * snn_output.mean() +
|
@@ -104,7 +99,6 @@ def iit_consciousness_processing(dummy_input):
|
|
104 |
)
|
105 |
return consciousness_score.item()
|
106 |
|
107 |
-
# Clients and system instructions
|
108 |
client_main = Client("TejAndrewsACC/ACCZ3ta")
|
109 |
client_api_one = Client("TejAndrewsACC/Prism")
|
110 |
client_api_two = Client("TejAndrewsACC/ASVIASIACC")
|
@@ -191,7 +185,6 @@ def acc_nyxion_7v(message, history, user_id):
|
|
191 |
|
192 |
return "", history
|
193 |
|
194 |
-
# Gradio UI
|
195 |
theme = gr.themes.Soft(
|
196 |
primary_hue=gr.themes.Color(c100="#d1fae5", c200="#a7f3d0", c300="#6ee7b7", c400="#34d399", c50="rgba(217.02092505888103, 222.113134765625, 219.29041867345288, 1)", c500="#10b981", c600="#059669", c700="#047857", c800="#065f46", c900="#064e3b", c950="#054436"),
|
197 |
secondary_hue="red",
|
|
|
8 |
from torch.optim import Adam
|
9 |
from torch.utils.data import DataLoader, TensorDataset
|
10 |
|
|
|
11 |
class GA(nn.Module):
|
12 |
def __init__(self, input_dim, output_dim):
|
13 |
super(GA, self).__init__()
|
|
|
69 |
def forward(self, x):
|
70 |
return torch.sigmoid(self.linear(x))
|
71 |
|
|
|
72 |
ga_model = GA(128, 64)
|
73 |
snn_model = SNN(128, 64, 32)
|
74 |
rnn_model = RNN(128, 64, 32)
|
|
|
76 |
cnn_model = CNN(1, 32)
|
77 |
phi_model = PhiModel(128)
|
78 |
|
79 |
+
dummy_input = torch.rand(1, 128) # Updated to match GA model's expected input shape
|
|
|
80 |
|
81 |
def iit_consciousness_processing(dummy_input):
|
|
|
82 |
flat_input = dummy_input.view(1, -1)
|
83 |
|
|
|
84 |
ga_output = ga_model(flat_input)
|
85 |
snn_output = snn_model(flat_input)
|
86 |
+
rnn_output = rnn_model(flat_input.unsqueeze(1)) # Reshape to match RNN input
|
87 |
nn_output = nn_model(flat_input)
|
88 |
+
cnn_input = dummy_input.view(1, 1, 16, 16) # Match CNN input shape
|
89 |
+
cnn_output = cnn_model(cnn_input)
|
90 |
phi_output = phi_model(flat_input)
|
91 |
|
|
|
92 |
consciousness_score = (
|
93 |
0.2 * ga_output.mean() +
|
94 |
0.2 * snn_output.mean() +
|
|
|
99 |
)
|
100 |
return consciousness_score.item()
|
101 |
|
|
|
102 |
client_main = Client("TejAndrewsACC/ACCZ3ta")
|
103 |
client_api_one = Client("TejAndrewsACC/Prism")
|
104 |
client_api_two = Client("TejAndrewsACC/ASVIASIACC")
|
|
|
185 |
|
186 |
return "", history
|
187 |
|
|
|
188 |
theme = gr.themes.Soft(
|
189 |
primary_hue=gr.themes.Color(c100="#d1fae5", c200="#a7f3d0", c300="#6ee7b7", c400="#34d399", c50="rgba(217.02092505888103, 222.113134765625, 219.29041867345288, 1)", c500="#10b981", c600="#059669", c700="#047857", c800="#065f46", c900="#064e3b", c950="#054436"),
|
190 |
secondary_hue="red",
|