Muleex12 commited on
Commit
7b098e7
·
verified ·
1 Parent(s): d5d5af6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -1,16 +1,23 @@
1
- import gradio as gr
 
2
 
3
- def predict(weight, mpg):
4
- return f"Weight: {weight}, MPG: {mpg}"
5
 
6
- demo = gr.Interface(
7
- fn=predict,
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
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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")