Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,6 +78,11 @@ def show_local_explanation():
|
|
| 78 |
else:
|
| 79 |
return None, "No prediction has been made yet."
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
# Gradio interface setup with introduction and instructions
|
| 82 |
with gr.Blocks() as app:
|
| 83 |
gr.Markdown("## Concrete Strength Prediction App")
|
|
@@ -91,6 +96,7 @@ with gr.Blocks() as app:
|
|
| 91 |
- Enter the composition of the concrete in the input fields.
|
| 92 |
- Click 'Predict Concrete Strength' to see the predicted strength.
|
| 93 |
- Click 'Show Detailed Report' to see a breakdown of each feature's impact on the prediction.
|
|
|
|
| 94 |
""")
|
| 95 |
|
| 96 |
with gr.Row():
|
|
@@ -103,11 +109,24 @@ with gr.Blocks() as app:
|
|
| 103 |
fine_agg = gr.Number(label="Fine Aggregate")
|
| 104 |
age = gr.Number(label="Age")
|
| 105 |
|
|
|
|
|
|
|
| 106 |
predict_btn = gr.Button("Predict Concrete Strength")
|
| 107 |
explanation_btn = gr.Button("Show Detailed Report")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
result = gr.Textbox(label="Predicted Concrete Strength")
|
| 109 |
local_image = gr.Image(label="Local Explanation", type="numpy")
|
| 110 |
explanation_text = gr.Textbox(label="Feature Impact Report")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
predict_btn.click(
|
| 113 |
fn=predict_strength,
|
|
@@ -119,5 +138,6 @@ with gr.Blocks() as app:
|
|
| 119 |
inputs=[],
|
| 120 |
outputs=[local_image, explanation_text]
|
| 121 |
)
|
|
|
|
| 122 |
|
| 123 |
app.launch()
|
|
|
|
| 78 |
else:
|
| 79 |
return None, "No prediction has been made yet."
|
| 80 |
|
| 81 |
+
# Function to provide the PDF guide
|
| 82 |
+
def download_guide():
|
| 83 |
+
pdf_path = "Guide.pdf" # Path to the uploaded guide
|
| 84 |
+
return pdf_path
|
| 85 |
+
|
| 86 |
# Gradio interface setup with introduction and instructions
|
| 87 |
with gr.Blocks() as app:
|
| 88 |
gr.Markdown("## Concrete Strength Prediction App")
|
|
|
|
| 96 |
- Enter the composition of the concrete in the input fields.
|
| 97 |
- Click 'Predict Concrete Strength' to see the predicted strength.
|
| 98 |
- Click 'Show Detailed Report' to see a breakdown of each feature's impact on the prediction.
|
| 99 |
+
- Click 'Download Guide' to learn about the concrete mix components and input guidelines.
|
| 100 |
""")
|
| 101 |
|
| 102 |
with gr.Row():
|
|
|
|
| 109 |
fine_agg = gr.Number(label="Fine Aggregate")
|
| 110 |
age = gr.Number(label="Age")
|
| 111 |
|
| 112 |
+
|
| 113 |
+
download_btn = gr.Button("Download Guide")
|
| 114 |
predict_btn = gr.Button("Predict Concrete Strength")
|
| 115 |
explanation_btn = gr.Button("Show Detailed Report")
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
guide_file = gr.File(label="Guide Download")
|
| 119 |
+
|
| 120 |
result = gr.Textbox(label="Predicted Concrete Strength")
|
| 121 |
local_image = gr.Image(label="Local Explanation", type="numpy")
|
| 122 |
explanation_text = gr.Textbox(label="Feature Impact Report")
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
download_btn.click(
|
| 126 |
+
fn=download_guide,
|
| 127 |
+
inputs=[],
|
| 128 |
+
outputs=guide_file
|
| 129 |
+
)
|
| 130 |
|
| 131 |
predict_btn.click(
|
| 132 |
fn=predict_strength,
|
|
|
|
| 138 |
inputs=[],
|
| 139 |
outputs=[local_image, explanation_text]
|
| 140 |
)
|
| 141 |
+
|
| 142 |
|
| 143 |
app.launch()
|