leorigasaki54 commited on
Commit
f482161
·
verified ·
1 Parent(s): cf054b4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from huggingface_hub import hf_hub_download
4
+ import joblib
5
+ import numpy as np
6
+
7
+ # Load model from Hub
8
+ model_repo = "leorigasaki54/earthquake-magnitude-predictor"
9
+ model = joblib.load(hf_hub_download(repo_id=model_repo, filename="rf_earthquake_mag.joblib"))
10
+
11
+ def predict(feature1, feature2, feature3, feature4, feature5):
12
+ input_data = np.array([[feature1, feature2, feature3, feature4, feature5]])
13
+ return model.predict(input_data)[0]
14
+
15
+ # Adjust labels/features based on your model's input requirements
16
+ inputs = [
17
+ gr.Number(label="Feature 1 (e.g., Seismic Signal)"),
18
+ gr.Number(label="Feature 2 (e.g., Depth)"),
19
+ gr.Number(label="Feature 3 (e.g., Latitude)"),
20
+ gr.Number(label="Feature 4 (e.g., Longitude)"),
21
+ gr.Number(label="Feature 5 (e.g., Station Distance)")
22
+ ]
23
+
24
+ gr.Interface(
25
+ fn=predict,
26
+ inputs=inputs,
27
+ outputs=gr.Number(label="Predicted Magnitude"),
28
+ title="Earthquake Magnitude Predictor",
29
+ description="Predict earthquake magnitude using seismic data"
30
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio>=4.0
2
+ scikit-learn>=1.0
3
+ joblib
4
+ huggingface-hub
5
+ numpy