Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
# Prediction using Gradio on Hugging Face
|
| 5 |
# Written by: Prakash R. Kota
|
| 6 |
# Written on: 12 Feb 2025
|
| 7 |
-
# Last update:
|
| 8 |
|
| 9 |
# Data Set from
|
| 10 |
# Original:
|
|
@@ -52,7 +52,7 @@ def predict(input_text):
|
|
| 52 |
import gradio as gr
|
| 53 |
|
| 54 |
# Create the Gradio interface
|
| 55 |
-
|
| 56 |
fn=predict,
|
| 57 |
inputs=gr.Textbox(label="Enter 30 feature values, comma-separated"),
|
| 58 |
outputs="text",
|
|
@@ -60,6 +60,28 @@ interface = gr.Interface(
|
|
| 60 |
description="Enter 30 numerical feature values separated by commas to predict whether the biopsy is Malignant or Benign."
|
| 61 |
)
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
# Launch the Gradio app
|
| 64 |
-
interface.launch()
|
|
|
|
|
|
|
| 65 |
|
|
|
|
| 4 |
# Prediction using Gradio on Hugging Face
|
| 5 |
# Written by: Prakash R. Kota
|
| 6 |
# Written on: 12 Feb 2025
|
| 7 |
+
# Last update: 17 Mar 2025
|
| 8 |
|
| 9 |
# Data Set from
|
| 10 |
# Original:
|
|
|
|
| 52 |
import gradio as gr
|
| 53 |
|
| 54 |
# Create the Gradio interface
|
| 55 |
+
iface = gr.Interface(
|
| 56 |
fn=predict,
|
| 57 |
inputs=gr.Textbox(label="Enter 30 feature values, comma-separated"),
|
| 58 |
outputs="text",
|
|
|
|
| 60 |
description="Enter 30 numerical feature values separated by commas to predict whether the biopsy is Malignant or Benign."
|
| 61 |
)
|
| 62 |
|
| 63 |
+
# Add the Markdown footer with a clickable hyperlink
|
| 64 |
+
footer = gr.Markdown("""
|
| 65 |
+
To test the Model, please copy the data from the original article, excluding the first two data points. <br>
|
| 66 |
+
For convenience, the data is reproduced here: <br>
|
| 67 |
+
17.99,10.38,122.8,1001,0.1184,0.2776,0.3001,0.1471,0.2419,0.07871,1.095,0.9053,8.589,153.4,0.006399,0.04904,0.05373,0.01587,0.03003,0.006193,25.38,17.33,184.6,2019,0.1622,0.6656,0.7119,0.2654,0.4601,0.1189 <br>
|
| 68 |
+
The original article -
|
| 69 |
+
<a href="https://prakashkota.com/2025/02/11/the-power-of-machine-learning-in-medical-diagnosis-breast-cancer-mini-case-using-neural-networks/" target="_blank">
|
| 70 |
+
The Power of Machine Learning in Medical Diagnosis – Breast Cancer Mini Case using Neural Networks</a>
|
| 71 |
+
""")
|
| 72 |
+
|
| 73 |
+
# Launch the interface with the footer
|
| 74 |
+
with gr.Blocks() as demo:
|
| 75 |
+
iface.render()
|
| 76 |
+
footer.render()
|
| 77 |
+
|
| 78 |
+
# Ensure the app launches when executed
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
demo.launch(share=True)
|
| 81 |
+
|
| 82 |
+
# The first version had the interface function for the Gradio markdown
|
| 83 |
# Launch the Gradio app
|
| 84 |
+
#interface.launch()
|
| 85 |
+
|
| 86 |
+
|
| 87 |
|