import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import gradio as gr df = pd.read_csv('https://huggingface.co/spaces/aksrad/GPA/resolve/main/SAT%20GPA.csv') from sklearn.model_selection import train_test_split X = df.drop(['*GPA (4.0 Scale)*'], axis=1) y = df['*GPA (4.0 Scale)*'] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) from sklearn.ensemble import RandomForestRegressor modelrf = RandomForestRegressor(n_estimators=100, random_state=42) modelrf.fit(X_train, y_train) #function for prediction #function for prediction def predict_gparf(sat_score): gpa = modelrf.predict([[sat_score]]) return gpa[0] #gradio app new = gr.Interface(fn=predict_gparf, inputs= [gr.Number (label= 'SAT_Score') ], title= 'GPA Predictor', outputs= [gr.Number (label= 'GPA')]) new.launch()