Spaces:
Runtime error
Runtime error
Update app.py
Browse files12345678910111213141516171819202122232425import gradio as grimport tensorflow as tf# Load the pickled modelmodel = tf.keras.models.load_model("census.h5")# Define the function for making predictionsdef salarybracket(age, workclass, education, education_num, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):inputs = [[age, workclass, education, education_num, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country]]prediction = model.predict(inputs)prediction_value = prediction[0]# Categorize prediction_valueif prediction_value == 0:result = "Income_bracket lesserthan or equal to 50K "else:result = "Income_bracket greater than to 50K"return f"Income_bracket Prediction: {prediction_value} \n\nResult: {result}"# Create the Gradio interfacesalarybracket_ga = gr.Interface(fn=salarybracket,inputs = [12345678910111213141516171819import gradio as grimport tensorflow as tfimport numpy as np# Load the pickled modelmodel = tf.keras.models.load_model("census.h5")# Define the function for making predictionsdef salarybracket(age, workclass, education, education_num, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country):inputs = np.array([[age, workclass, education, education_num, marital_status, occupation, relationship, race, gender, capital_gain, capital_loss, hours_per_week, native_country]])prediction = model.predict(inputs)prediction_value = prediction[0][0] # Assuming the prediction is a scalarresult = "Income_bracket lesser than or equal to 50K" if prediction_value <= 0.5 else "Income_bracket greater than 50K"return f"Income_bracket Prediction: {prediction_value} \n\nResult: {result}"# Create the Gradio interfacesalarybracket_ga = gr.Interface(fn=salarybracket,inputs = [
app.py+5-11