Update app.py
Browse files
app.py
CHANGED
@@ -47,12 +47,7 @@ with gr.Blocks() as demo:
|
|
47 |
gr.Markdown("## Learning the XOR function: An application of Binary Classification using Non-linear SVM")
|
48 |
gr.Markdown("### This demo is based on this [scikit-learn example](https://scikit-learn.org/stable/auto_examples/svm/plot_svm_nonlinear.html#sphx-glr-auto-examples-svm-plot-svm-nonlinear-py).")
|
49 |
gr.Markdown("### In this demo, we use a non-linear SVC (Support Vector Classifier) to learn the decision function of the XOR operator.")
|
50 |
-
|
51 |
-
xor_image = Image.open("xor.png")
|
52 |
-
gr.Image(xor_image, label="Table explaining the 'XOR' operator")
|
53 |
-
|
54 |
-
gr.HTML("<hr>")
|
55 |
-
|
56 |
gr.Markdown("### Furthermore, we observe that we get different decision function plots by varying the Kernel and Gamma hyperparameters of the non-linear SVC.")
|
57 |
|
58 |
gr.Markdown("### Feel free to experiment with kernel and gamma values below to see how the quality of the decision function changes with the hyperparameters.")
|
@@ -62,11 +57,16 @@ with gr.Blocks() as demo:
|
|
62 |
btn = gr.Button(value="Submit")
|
63 |
|
64 |
with gr.Row():
|
65 |
-
plot = gr.Plot(label=f"Decision function plot for Non-Linear SVC with the '{inp1}' kernel and '{inp2}' gamma ")
|
66 |
num = gr.Textbox(label="Test Accuracy")
|
67 |
|
68 |
btn.click(getColorMap, inputs=[inp1, inp2], outputs=[plot, num])
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
if __name__ == "__main__":
|
72 |
print("hdh")
|
|
|
47 |
gr.Markdown("## Learning the XOR function: An application of Binary Classification using Non-linear SVM")
|
48 |
gr.Markdown("### This demo is based on this [scikit-learn example](https://scikit-learn.org/stable/auto_examples/svm/plot_svm_nonlinear.html#sphx-glr-auto-examples-svm-plot-svm-nonlinear-py).")
|
49 |
gr.Markdown("### In this demo, we use a non-linear SVC (Support Vector Classifier) to learn the decision function of the XOR operator.")
|
50 |
+
|
|
|
|
|
|
|
|
|
|
|
51 |
gr.Markdown("### Furthermore, we observe that we get different decision function plots by varying the Kernel and Gamma hyperparameters of the non-linear SVC.")
|
52 |
|
53 |
gr.Markdown("### Feel free to experiment with kernel and gamma values below to see how the quality of the decision function changes with the hyperparameters.")
|
|
|
57 |
btn = gr.Button(value="Submit")
|
58 |
|
59 |
with gr.Row():
|
60 |
+
plot = gr.Plot(label=f"Decision function plot for Non-Linear SVC with the '{inp1}' kernel and '{inp2}' gamma ").properties(object-fit="contain")
|
61 |
num = gr.Textbox(label="Test Accuracy")
|
62 |
|
63 |
btn.click(getColorMap, inputs=[inp1, inp2], outputs=[plot, num])
|
64 |
|
65 |
+
gr.HTML("<hr>")
|
66 |
+
|
67 |
+
xor_image = Image.open("xor.png")
|
68 |
+
gr.Image(xor_image, label="Table explaining the 'XOR' operator")
|
69 |
+
|
70 |
|
71 |
if __name__ == "__main__":
|
72 |
print("hdh")
|