SharkGaming
commited on
Commit
•
60ef86d
1
Parent(s):
84b3d3d
Update api.py
Browse files
api.py
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
# Define the function to make predictions using the Hugging Face Inference API
|
7 |
-
def predict_rooms(population):
|
8 |
-
payload = {"inputs": population}
|
9 |
-
response = requests.post(API_URL, json=payload)
|
10 |
-
result = response.json()
|
11 |
-
return result["predictions"][0]
|
12 |
-
|
13 |
-
# Make predictions using the predict_rooms function
|
14 |
-
prediction = predict_rooms(1000)
|
15 |
-
print(prediction)
|
|
|
1 |
+
# Step 9: Create a Gradio interface
|
2 |
+
iface = gr.Interface(
|
3 |
+
fn=predict_rooms,
|
4 |
+
inputs="number",
|
5 |
+
outputs="number",
|
6 |
+
title="Number of Rooms Predictor",
|
7 |
+
description="Enter the population to predict the number of rooms needed."
|
8 |
+
)
|
9 |
|
10 |
+
# Step 10: Launch the Gradio interface
|
11 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|