Update app.py
Browse files
app.py
CHANGED
@@ -1,49 +1,17 @@
|
|
1 |
-
import joblib
|
2 |
-
import pandas as pd
|
3 |
import streamlit as st
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
model = joblib.load('model_a.joblib')
|
8 |
-
unique_values = unique_values = joblib.load('unique_values.joblib')
|
9 |
-
|
10 |
-
unique_store_city = unique_values["store_city"]
|
11 |
-
unique_promotion_name= unique_values["promotion_name"]
|
12 |
-
unique_media_type = unique_values["media_type"]
|
13 |
-
unique_store_type = unique_values["store_type"]
|
14 |
-
unique_sales_country= unique_values["sales_country"]
|
15 |
-
unique_store_state = unique_values["store_state"]
|
16 |
-
|
17 |
def main():
|
18 |
-
st.title("
|
19 |
-
|
20 |
-
with st.form("questionaire"):
|
21 |
-
store_sqft = st.slider('store_sqft',min_value=10,max_value=100)
|
22 |
-
store_city = st.selectbox('store_city',options=unique_store_city)
|
23 |
-
promotion_name = st.selectbox('promotion_name',options=unique_promotion_name)
|
24 |
-
media_type = st.selectbox('media_type ',options=unique_media_type)
|
25 |
-
store_type = st.selectbox('Occupation',options=unique_store_type)
|
26 |
-
sales_country = st.selectbox('Relationship',options=sales_country)
|
27 |
-
store_state = st.selectbox('sales_country',options=unique_store_state)
|
28 |
-
meat_sqft = st.slider('meat_sqft',min_value=1,max_value=100)
|
29 |
-
frozen_sqft = st.slider('frozen_sqft',min_value=1,max_value=100)
|
30 |
|
|
|
|
|
31 |
# clicked==True only when the button is clicked
|
32 |
-
clicked = st.form_submit_button("
|
33 |
if clicked:
|
34 |
-
|
35 |
-
|
36 |
-
"promotion_name": [promotion_name],
|
37 |
-
"media_type": [media_type],
|
38 |
-
"store_type ": [store_type ],
|
39 |
-
"sales_country": [sales_country],
|
40 |
-
"store_state": [store_state],
|
41 |
-
"meat_sqft": [meat_sqft],
|
42 |
-
"frozen_sqft": [frozen_sqft]}))
|
43 |
|
44 |
-
# Show prediction
|
45 |
-
|
46 |
-
st.success('Your Predicted income is' + result)
|
47 |
-
# Run main()
|
48 |
if __name__ == "__main__":
|
49 |
main()
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
classifier = pipeline("text-generation", model="distilbert-base-uncased-finetuned-sst-2-english")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def main():
|
6 |
+
st.title("text-generation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
with st.form("text_field"):
|
9 |
+
text = st.text_area('enter some text:')
|
10 |
# clicked==True only when the button is clicked
|
11 |
+
clicked = st.form_submit_button("Submit")
|
12 |
if clicked:
|
13 |
+
results = classifier([text])
|
14 |
+
st.json(results)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
|
|
|
|
|
|
|
|
16 |
if __name__ == "__main__":
|
17 |
main()
|