Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Output and Imput
|
| 4 |
+
input_1 = gr.inputs.Textbox(label = "Input Text")
|
| 5 |
+
input_2 = gr.inputs.Image(label = "Input Image")
|
| 6 |
+
|
| 7 |
+
output_1 = gr.outputs.Textbox(label = "Predicted Housing Prices")
|
| 8 |
+
output_2 = gr.outputs.Image(label = "Visualization of the location")
|
| 9 |
+
|
| 10 |
+
# Creating Sliders
|
| 11 |
+
input_longitude = gr.inputs.Slider(-124.35, 114.35, step=1, label = "Longitude")
|
| 12 |
+
input_latitude = gr.inputs.Slider(32, 41, step=1, label = "Latitude")
|
| 13 |
+
input_housing_median = gr.inputs.Slider(1, 52, step=1, label = "Housing_median")
|
| 14 |
+
input_total_rooms = gr.inputs.Slider(1, 39996, step=1, label = "Total_rooms")
|
| 15 |
+
input_total_bedrooms = gr.inputs.Slider(1, 6441, step=1, label = "Total_bedrooms")
|
| 16 |
+
input_population = gr.inputs.Slider(10, 35678, step=1, label = "Population")
|
| 17 |
+
input_households = gr.inputs.Slider(10, 6081, step=1, label = "Households")
|
| 18 |
+
input_median_income = gr.inputs.Slider(0, 15, step=0.1, label = "Median_income")
|
| 19 |
+
|
| 20 |
+
# Define a new function that accommodates the input modules.
|
| 21 |
+
def multi_inputs(input_longitude, input_latitude, input_housing_median, input_total_rooms, input_total_bedrooms, input_population, input_households, input_median_income):
|
| 22 |
+
import numpy as np
|
| 23 |
+
## processing inputs
|
| 24 |
+
|
| 25 |
+
## return outputs
|
| 26 |
+
output1 = "Processing inputs and return outputs" # text output example
|
| 27 |
+
output2 = np.random.rand(6,6) # image-like array output example
|
| 28 |
+
return output1,output2
|
| 29 |
+
|
| 30 |
+
# Define a new function that accommodates the input modules.
|
| 31 |
+
def multi_inputs(input_longitude, input_latitude, input_housing_median, input_total_rooms, input_total_bedrooms, input_population, input_households, input_median_income):
|
| 32 |
+
import numpy as np
|
| 33 |
+
## processing inputs
|
| 34 |
+
|
| 35 |
+
## return outputs
|
| 36 |
+
output1 = "Processing inputs and return outputs" # text output example
|
| 37 |
+
output2 = np.random.rand(6,6) # image-like array output example
|
| 38 |
+
return output1,output2
|