Manul, da
commited on
Commit
·
f47174e
1
Parent(s):
8419ac2
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,15 @@ import gradio as gr
|
|
| 2 |
import net
|
| 3 |
import start
|
| 4 |
|
| 5 |
-
def
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import net
|
| 3 |
import start
|
| 4 |
|
| 5 |
+
def binary_to_int(binary_array):
|
| 6 |
+
# Reverse the array to start from the least significant bit
|
| 7 |
+
binary_array = np.flip(binary_array)
|
| 8 |
|
| 9 |
+
# Initialize the result
|
| 10 |
+
result = 0
|
| 11 |
+
|
| 12 |
+
# Iterate over the array and calculate the decimal value
|
| 13 |
+
for i, bit in enumerate(binary_array):
|
| 14 |
+
result += bit * (2 ** i)
|
| 15 |
+
|
| 16 |
+
return result
|