Spaces:
Runtime error
Runtime error
Commit
•
5b34025
1
Parent(s):
c0c31da
initial commit
Browse files
mhv.py
CHANGED
@@ -1,39 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""mhv.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1LmvAjCNd9_oRUyNiEVGGtMWE12gY7tox
|
8 |
-
"""
|
9 |
-
|
10 |
-
!pip install --quiet gradio
|
11 |
-
|
12 |
-
import gradio as gr
|
13 |
-
input_long=gr.inputs.Slider(-124.35, -114.34, step=0.1,label="longitude")
|
14 |
-
input_lati=gr.inputs.Slider(32, 41, step=0.5,label="latitude")
|
15 |
-
input_hmg=gr.inputs.Slider(1, 55, step=1,label="Housing_median_age (Year)")
|
16 |
-
input_tr=gr.inputs.Slider(1, 40000, step=12,label="Total_rooms")
|
17 |
-
input_tb=gr.inputs.Slider(1, 6500, step=5,label="Total_Bedrooms")
|
18 |
-
input_p=gr.inputs.Slider(3, 35678, step=5,label="Population")
|
19 |
-
input_hh=gr.inputs.Slider(1, 6081, step=5,label="Households")
|
20 |
-
input_mi=gr.inputs.Slider(0, 15, step=1,label="Median_income")
|
21 |
-
output_mhv = gr.outputs.Textbox(label = "Predicted housing price")
|
22 |
-
output_mhv1 = gr.outputs.Image(label = "Median house value")
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
def house_price(input_long, input_lati, input_hmg, input_tr, input_tb, input_p, input_hh, input_mi ):
|
29 |
-
import numpy as np
|
30 |
-
import pandas as pd
|
31 |
-
## processing inputs
|
32 |
-
|
33 |
-
## return outputs
|
34 |
-
output1 = 111253
|
35 |
-
output2 = np.random.rand(5,5)
|
36 |
-
return output1,output2
|
37 |
-
|
38 |
-
iface=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] )
|
39 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|