SharkGaming commited on
Commit
60ef86d
1 Parent(s): 84b3d3d

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +10 -14
api.py CHANGED
@@ -1,15 +1,11 @@
1
- import requests
 
 
 
 
 
 
 
2
 
3
- # Define the API endpoint for your Hugging Face model
4
- API_URL = "https://jpb8uaoih9-496ff2e9c6d22116-7863-colab.googleusercontent.com/"
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()