Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,23 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return f"Weight: {weight}, MPG: {mpg}"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
inputs=[
|
| 9 |
-
gr.Number(label="Enter weight"),
|
| 10 |
-
gr.Number(label="Enter mpg")
|
| 11 |
-
],
|
| 12 |
-
outputs="text",
|
| 13 |
-
title="SuperKart Frontend"
|
| 14 |
-
)
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
|
| 4 |
+
st.title("SuperKart Frontend")
|
|
|
|
| 5 |
|
| 6 |
+
weight = st.number_input("Enter weight", value=0.0)
|
| 7 |
+
mpg = st.number_input("Enter mpg", value=0.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
if st.button("Predict"):
|
| 10 |
+
|
| 11 |
+
url = "https://muleex12-backkends.hf.space/run/predict"
|
| 12 |
+
|
| 13 |
+
payload = {
|
| 14 |
+
"data": [weight, mpg]
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
response = requests.post(url, json=payload)
|
| 18 |
+
|
| 19 |
+
if response.status_code == 200:
|
| 20 |
+
result = response.json()["data"][0]
|
| 21 |
+
st.success(f"Prediction: {result}")
|
| 22 |
+
else:
|
| 23 |
+
st.error("Error connecting to backend")
|