Spaces:
Runtime error
Runtime error
Commit ·
f2e8c83
1
Parent(s): 38fe687
Changing gradio app
Browse files- gradio_app.py → app.py +7 -2
- run_tests.sh +2 -2
gradio_app.py → app.py
RENAMED
|
@@ -5,6 +5,7 @@ from quantum_perceptron import Perceptron
|
|
| 5 |
|
| 6 |
matplotlib.pyplot.switch_backend('Agg')
|
| 7 |
|
|
|
|
| 8 |
def run_perceptron(
|
| 9 |
num_qubits: int,
|
| 10 |
input_value: int,
|
|
@@ -23,11 +24,14 @@ def run_perceptron(
|
|
| 23 |
plt.tight_layout()
|
| 24 |
return prob_1, freq_hist
|
| 25 |
|
|
|
|
| 26 |
app_inputs = [
|
| 27 |
gr.Slider(1, 9, value=2, step=1, label="Number of Qubits"),
|
| 28 |
gr.Number(value=12, label="Input Value", precision=0),
|
| 29 |
gr.Number(value=13, label="Weight Value", precision=0),
|
| 30 |
-
gr.Number(value=1000,
|
|
|
|
|
|
|
| 31 |
]
|
| 32 |
|
| 33 |
app_outputs = [
|
|
@@ -39,5 +43,6 @@ demo = gr.Interface(
|
|
| 39 |
fn=run_perceptron,
|
| 40 |
inputs=app_inputs,
|
| 41 |
outputs=app_outputs,
|
|
|
|
| 42 |
)
|
| 43 |
-
demo.launch(
|
|
|
|
| 5 |
|
| 6 |
matplotlib.pyplot.switch_backend('Agg')
|
| 7 |
|
| 8 |
+
|
| 9 |
def run_perceptron(
|
| 10 |
num_qubits: int,
|
| 11 |
input_value: int,
|
|
|
|
| 24 |
plt.tight_layout()
|
| 25 |
return prob_1, freq_hist
|
| 26 |
|
| 27 |
+
|
| 28 |
app_inputs = [
|
| 29 |
gr.Slider(1, 9, value=2, step=1, label="Number of Qubits"),
|
| 30 |
gr.Number(value=12, label="Input Value", precision=0),
|
| 31 |
gr.Number(value=13, label="Weight Value", precision=0),
|
| 32 |
+
gr.Number(value=1000,
|
| 33 |
+
label="Number of Measurement Iterations",
|
| 34 |
+
precision=0),
|
| 35 |
]
|
| 36 |
|
| 37 |
app_outputs = [
|
|
|
|
| 43 |
fn=run_perceptron,
|
| 44 |
inputs=app_inputs,
|
| 45 |
outputs=app_outputs,
|
| 46 |
+
title="Simulate Quantum Perceptron",
|
| 47 |
)
|
| 48 |
+
demo.launch()
|
run_tests.sh
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
echo "#### RUNNING MYPY TESTS ####"
|
| 2 |
-
PYTHONDONTWRITEBYTECODE=1 mypy
|
| 3 |
|
| 4 |
echo "#### RUNNING PYCODESTYLE TESTS ####"
|
| 5 |
-
pycodestyle
|
| 6 |
|
| 7 |
echo "#### RUNNING PYTEST TESTS ####"
|
| 8 |
PYTHONDONTWRITEBYTECODE=1 python -m pytest -p no:cacheprovider
|
|
|
|
| 1 |
echo "#### RUNNING MYPY TESTS ####"
|
| 2 |
+
PYTHONDONTWRITEBYTECODE=1 mypy ./
|
| 3 |
|
| 4 |
echo "#### RUNNING PYCODESTYLE TESTS ####"
|
| 5 |
+
pycodestyle ./
|
| 6 |
|
| 7 |
echo "#### RUNNING PYTEST TESTS ####"
|
| 8 |
PYTHONDONTWRITEBYTECODE=1 python -m pytest -p no:cacheprovider
|