import gradio as gr from huggingface_hub import hf_hub_download import joblib import numpy as np # Load model from Hub model_repo = "leorigasaki54/earthquake-magnitude-predictor" model = joblib.load(hf_hub_download(repo_id=model_repo, filename="rf_earthquake_mag.joblib")) def predict(feature1, feature2, feature3, feature4, feature5): input_data = np.array([[feature1, feature2, feature3, feature4, feature5]]) return model.predict(input_data)[0] # Adjust labels/features based on your model's input requirements inputs = [ gr.Number(label="Feature 1 (e.g., Seismic Signal)"), gr.Number(label="Feature 2 (e.g., Depth)"), gr.Number(label="Feature 3 (e.g., Latitude)"), gr.Number(label="Feature 4 (e.g., Longitude)"), gr.Number(label="Feature 5 (e.g., Station Distance)") ] gr.Interface( fn=predict, inputs=inputs, outputs=gr.Number(label="Predicted Magnitude"), title="Earthquake Magnitude Predictor", description="Predict earthquake magnitude using seismic data" ).launch()