Spaces:
Runtime error
Runtime error
Commit
•
07ac300
1
Parent(s):
5b34025
initial commit
Browse files
mhv.py
CHANGED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
!pip install --quiet gradio
|
4 |
+
|
5 |
+
import gradio as gr
|
6 |
+
input_long=gr.inputs.Slider(-124.35, -114.34, step=0.1,label="longitude")
|
7 |
+
input_lati=gr.inputs.Slider(32, 41, step=0.5,label="latitude")
|
8 |
+
input_hmg=gr.inputs.Slider(1, 55, step=1,label="Housing_median_age (Year)")
|
9 |
+
input_tr=gr.inputs.Slider(1, 40000, step=12,label="Total_rooms")
|
10 |
+
input_tb=gr.inputs.Slider(1, 6500, step=5,label="Total_Bedrooms")
|
11 |
+
input_p=gr.inputs.Slider(3, 35678, step=5,label="Population")
|
12 |
+
input_hh=gr.inputs.Slider(1, 6081, step=5,label="Households")
|
13 |
+
input_mi=gr.inputs.Slider(0, 15, step=1,label="Median_income")
|
14 |
+
output_mhv = gr.outputs.Textbox(label = "Predicted housing price")
|
15 |
+
output_mhv1 = gr.outputs.Image(label = "Median house value")
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
def house_price(input_long, input_lati, input_hmg, input_tr, input_tb, input_p, input_hh, input_mi ):
|
22 |
+
import numpy as np
|
23 |
+
import pandas as pd
|
24 |
+
## processing inputs
|
25 |
+
|
26 |
+
## return outputs
|
27 |
+
output1 = 111253
|
28 |
+
output2 = np.random.rand(5,5)
|
29 |
+
return output1,output2
|
30 |
+
|
31 |
+
gr.Interface( title="house Prediction",description="This model gives the estimated price of a house." ,fn=house_price,inputs=[input_long, input_lati, input_hmg, input_tr, input_tb, input_p, input_hh, input_mi], outputs=[output_mhv, output_mhv1] ).launch()
|