Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import gradio as gr
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
|
| 6 |
# Load the pre-trained model
|
| 7 |
-
model = joblib.load("best_model.pkl")
|
| 8 |
|
| 9 |
# Function to predict and generate the plot
|
| 10 |
def predict_and_plot(*input_features):
|
|
@@ -98,7 +98,7 @@ def predict_and_plot(*input_features):
|
|
| 98 |
if warnings:
|
| 99 |
pred_text += "\n\n" + "\n".join(warnings)
|
| 100 |
|
| 101 |
-
#
|
| 102 |
marketing_text = (
|
| 103 |
"**Developed by:** \nMuntasir Shehab*, Reza Taherdangkoo and Christoph Butscher \n\n"
|
| 104 |
"**Institution:** \nTU Bergakademie Freiberg, Institute of Geotechnics \n"
|
|
@@ -107,7 +107,7 @@ def predict_and_plot(*input_features):
|
|
| 107 |
|
| 108 |
return pred_text, plot_path_png, plot_path_png, plot_path_eps, marketing_text
|
| 109 |
|
| 110 |
-
#
|
| 111 |
input_fields = [
|
| 112 |
# First two dropdowns (never show trained range)
|
| 113 |
{"name": "Condition", "choices": ["Confined", "Unconfined"], "default": "Confined", "trained_range": "0-1", "show_trained": False},
|
|
@@ -127,7 +127,7 @@ input_fields = [
|
|
| 127 |
{"name": "Specific suction to calculate the water content at single point", "min": 0.001, "max": 100000, "default": 10, "unit": "hPa", "step": 1, "trained_range": "0.01-100000", "show_trained": True},
|
| 128 |
]
|
| 129 |
|
| 130 |
-
#
|
| 131 |
inputs = []
|
| 132 |
for i, field in enumerate(input_fields):
|
| 133 |
if i < 2: # Condition and Path Type dropdowns
|
|
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
|
| 6 |
# Load the pre-trained model
|
| 7 |
+
model = joblib.load("best_model.pkl")
|
| 8 |
|
| 9 |
# Function to predict and generate the plot
|
| 10 |
def predict_and_plot(*input_features):
|
|
|
|
| 98 |
if warnings:
|
| 99 |
pred_text += "\n\n" + "\n".join(warnings)
|
| 100 |
|
| 101 |
+
# Team text
|
| 102 |
marketing_text = (
|
| 103 |
"**Developed by:** \nMuntasir Shehab*, Reza Taherdangkoo and Christoph Butscher \n\n"
|
| 104 |
"**Institution:** \nTU Bergakademie Freiberg, Institute of Geotechnics \n"
|
|
|
|
| 107 |
|
| 108 |
return pred_text, plot_path_png, plot_path_png, plot_path_eps, marketing_text
|
| 109 |
|
| 110 |
+
# Input fields configuration
|
| 111 |
input_fields = [
|
| 112 |
# First two dropdowns (never show trained range)
|
| 113 |
{"name": "Condition", "choices": ["Confined", "Unconfined"], "default": "Confined", "trained_range": "0-1", "show_trained": False},
|
|
|
|
| 127 |
{"name": "Specific suction to calculate the water content at single point", "min": 0.001, "max": 100000, "default": 10, "unit": "hPa", "step": 1, "trained_range": "0.01-100000", "show_trained": True},
|
| 128 |
]
|
| 129 |
|
| 130 |
+
# Input component creation
|
| 131 |
inputs = []
|
| 132 |
for i, field in enumerate(input_fields):
|
| 133 |
if i < 2: # Condition and Path Type dropdowns
|