Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,9 @@
|
|
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")
|
@@ -17,22 +13,14 @@ 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 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
output2 = np.random.rand(6,6) # image-like array output example
|
28 |
return output1,output2
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
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
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
input_1 = gr.inputs.Textbox(label = "Input Text")
|
4 |
input_2 = gr.inputs.Image(label = "Input Image")
|
|
|
5 |
output_1 = gr.outputs.Textbox(label = "Predicted Housing Prices")
|
6 |
output_2 = gr.outputs.Image(label = "Visualization of the location")
|
|
|
|
|
7 |
input_longitude = gr.inputs.Slider(-124.35, 114.35, step=1, label = "Longitude")
|
8 |
input_latitude = gr.inputs.Slider(32, 41, step=1, label = "Latitude")
|
9 |
input_housing_median = gr.inputs.Slider(1, 52, step=1, label = "Housing_median")
|
|
|
13 |
input_households = gr.inputs.Slider(10, 6081, step=1, label = "Households")
|
14 |
input_median_income = gr.inputs.Slider(0, 15, step=0.1, label = "Median_income")
|
15 |
|
|
|
16 |
def multi_inputs(input_longitude, input_latitude, input_housing_median, input_total_rooms, input_total_bedrooms, input_population, input_households, input_median_income):
|
17 |
import numpy as np
|
18 |
+
import pandas as pd
|
19 |
|
20 |
+
output1 = "Processing inputs and return outputs"
|
21 |
+
output2 = np.random.rand(6,6)
|
|
|
22 |
return output1,output2
|
23 |
|
24 |
+
gr.Interface(fn=multi_inputs, inputs=[input_longitude, input_latitude, input_housing_median, input_total_rooms, input_total_bedrooms, input_population, input_households, input_median_income],
|
25 |
+
outputs=[output_1, output_2]
|
26 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|