Spaces:
Runtime error
Runtime error
initial
Browse files- README.md +5 -5
- app.py +75 -0
- requirements.txt +2 -0
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
-
sdk_version: 1.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
1 |
---
|
2 |
+
title: Frontend German Traffic Sign Recognition
|
3 |
+
emoji: π
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: gray
|
6 |
sdk: streamlit
|
7 |
+
sdk_version: 1.10.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import requests
|
4 |
+
|
5 |
+
def run():
|
6 |
+
with st.form(key='form_parameters'):
|
7 |
+
customerID = st.text_input('Customer ID')
|
8 |
+
gender = st.radio('Gender', ('Male', 'Female'))
|
9 |
+
SeniorCitizen = st.radio('Is a Senior Citizen', (0, 1))
|
10 |
+
Partner = st.radio('Have a Partner', ('Yes', 'No'))
|
11 |
+
Dependents = st.radio('Have any Dependents', ('Yes', 'No'))
|
12 |
+
|
13 |
+
PhoneService = st.radio('Phone Service', ('Yes', 'No'))
|
14 |
+
MultipleLines = st.radio('Multiple Lines', ('Yes', 'No', 'No phone service'))
|
15 |
+
InternetService = st.radio('Internet Service', ('DSL', 'Fiber Optic', 'No'))
|
16 |
+
OnlineSecurity = st.radio('Online Security', ('Yes', 'No', 'No internet service'))
|
17 |
+
OnlineBackup = st.radio('Online Backup', ('Yes', 'No', 'No internet service'))
|
18 |
+
DeviceProtection = st.radio('Device Protection', ('Yes', 'No', 'No internet service'))
|
19 |
+
TechSupport = st.radio('Tech Support', ('Yes', 'No', 'No internet service'))
|
20 |
+
StreamingTV = st.radio('Streaming TV', ('Yes', 'No', 'No internet service'))
|
21 |
+
StreamingMovies = st.radio('Streaming Movies', ('Yes', 'No', 'No internet service'))
|
22 |
+
|
23 |
+
tenure = st.number_input('Tenure', min_value=1, value=5)
|
24 |
+
Contract = st.radio('Contract Term', ('Month-to-month', 'One year', 'Two year'))
|
25 |
+
PaperlessBilling = st.radio('Paperless Billing', ('Yes', 'No'))
|
26 |
+
PaymentMethod = st.radio('Payment Method', ('Bank transfer (automatic)', 'Credit card (automatic)', 'Electronic check', 'Mailed check'))
|
27 |
+
MonthlyCharges = st.number_input('Monthly Charges', min_value=0, value=50)
|
28 |
+
TotalCharges = st.number_input('Total Charges', min_value=0, value=1000)
|
29 |
+
|
30 |
+
submitted = st.form_submit_button('Predict')
|
31 |
+
|
32 |
+
# Create A New data
|
33 |
+
data_inf = {
|
34 |
+
'customerID': customerID,
|
35 |
+
'gender': gender,
|
36 |
+
'SeniorCitizen': SeniorCitizen,
|
37 |
+
'Partner': Partner,
|
38 |
+
'Dependents': Dependents,
|
39 |
+
'PhoneService': PhoneService,
|
40 |
+
'MultipleLines': MultipleLines,
|
41 |
+
'InternetService': InternetService,
|
42 |
+
'OnlineSecurity': OnlineSecurity,
|
43 |
+
'OnlineBackup': OnlineBackup,
|
44 |
+
'DeviceProtection': DeviceProtection,
|
45 |
+
'TechSupport': TechSupport,
|
46 |
+
'StreamingTV': StreamingTV,
|
47 |
+
'StreamingMovies': StreamingMovies,
|
48 |
+
'tenure': tenure,
|
49 |
+
'Contract': Contract,
|
50 |
+
'PaperlessBilling': PaperlessBilling,
|
51 |
+
'PaymentMethod': PaymentMethod,
|
52 |
+
'MonthlyCharges': MonthlyCharges,
|
53 |
+
'TotalCharges': TotalCharges
|
54 |
+
}
|
55 |
+
|
56 |
+
if submitted:
|
57 |
+
# Show Inference DataFrame
|
58 |
+
st.dataframe(pd.DataFrame([data_inf]))
|
59 |
+
print('[DEBUG] Data Inference : \n', data_inf)
|
60 |
+
|
61 |
+
# Predict
|
62 |
+
URL = "https://backend-m1p2-casheu.koyeb.app/predict"
|
63 |
+
r = requests.post(URL, json=data_inf)
|
64 |
+
|
65 |
+
if r.status_code == 200:
|
66 |
+
res = r.json()
|
67 |
+
st.write('## Prediction : ', res['label_names'])
|
68 |
+
print('[DEBUG] Result : ', res)
|
69 |
+
print('')
|
70 |
+
else:
|
71 |
+
st.write('Error with status code ', str(r.status_code))
|
72 |
+
|
73 |
+
|
74 |
+
if __name__ == '__main__':
|
75 |
+
run()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
pandas
|