Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import math # Import the math module
|
|
8 |
from matplotlib import animation
|
9 |
from mpl_toolkits.mplot3d import Axes3D
|
10 |
from streamlit.components.v1 import html
|
|
|
11 |
|
12 |
# Sidebar for selecting an option
|
13 |
sidebar_option = st.sidebar.radio("Select an option",
|
@@ -152,9 +153,13 @@ def algorithms_circuits():
|
|
152 |
if st.button("Generate Circuit"):
|
153 |
if boolean_expression:
|
154 |
try:
|
155 |
-
#
|
156 |
-
|
157 |
|
|
|
|
|
|
|
|
|
158 |
# Convert the formula to a circuit
|
159 |
circuit = formula_to_circuit(expr)
|
160 |
|
|
|
8 |
from matplotlib import animation
|
9 |
from mpl_toolkits.mplot3d import Axes3D
|
10 |
from streamlit.components.v1 import html
|
11 |
+
from sympy.logic.boolalg import Or, And, Not
|
12 |
|
13 |
# Sidebar for selecting an option
|
14 |
sidebar_option = st.sidebar.radio("Select an option",
|
|
|
153 |
if st.button("Generate Circuit"):
|
154 |
if boolean_expression:
|
155 |
try:
|
156 |
+
# Define symbols
|
157 |
+
x, y, z = symbols('x y z')
|
158 |
|
159 |
+
# Use eval to parse the input expression and replace symbols
|
160 |
+
expr = eval(boolean_expression, {}, {
|
161 |
+
"Or": Or, "And": And, "Not": Not, "x": x, "y": y, "z": z})
|
162 |
+
|
163 |
# Convert the formula to a circuit
|
164 |
circuit = formula_to_circuit(expr)
|
165 |
|