def main(): # track web app activity streamlit_analytics.start_tracking() # Web Page Headers st.write(""" # Wine Quality Prediction Web-App This app predicts the ** Quality of your Red Wine ** using **wine features** input via the **side panel** """) #read in wine image and render with streamlit image = Image.open('resources/wine_image.jpg') st.image(image, caption='The Wine Grader Company', use_column_width=True) st.sidebar.header( 'User Input Parameters' ) #user input parameter collection with streamlit side bar # Load ML models model_knn = joblib.load(open("model/autoML-model_knn.joblib", "rb")) model_decis_tree = joblib.load( open("model/autoML-model_Decision-Tree.joblib", "rb")) model_log_reg = joblib.load( open("model/autoML-model_Log-Regress.joblib", "rb")) # user input variables user_input_df = get_user_input() processed_user_input = data_preprocessor(user_input_df) st.subheader('User Input parameters') st.write(user_input_df) # machine learning techniques results variables prediction_knn = model_knn.predict(processed_user_input) prediction__decis_tree = model_decis_tree.predict(processed_user_input) prediction_log_reg = model_log_reg.predict(processed_user_input) # output machine learning results st.write("Ask our A.I. wine connaisseur for their opinion") connaisseur_choice = st.selectbox("Connaisseur opinion: ", [ '', 'The decision tree connaisseur', 'The KNN connaisseur', 'The logistic regression connaisseur' ]) # A.I opinion displayed if (connaisseur_choice == "The decision tree connaisseur"): st.write("The decision tree connaisseur verdict: ") if (prediction__decis_tree == 1): st.write( "Good quality wine! This wine is at least a 7 in my expert opinion. You got great test!" ) choose_image = randrange(1) if (choose_image == 1): image = Image.open('resources/wineconnaisseur_1.png') st.image(image, use_column_width=True) else: image = Image.open('resources/wineconnaisseur_3.png') st.image(image, use_column_width=True) else: st.write( "bad quality wine! Do yourself a favor and throw away this thing you call wine...." ) image = Image.open('resources/wineconnaisseur_2.png') st.image(image, use_column_width=True) if (connaisseur_choice == "The KNN connaisseur"): st.write("The KNN connaisseur verdict: ") if (prediction_knn == 1): st.write( "Good quality wine! This wine is at least a 7 in my expert opinion. You got great test!" ) choose_image = randrange(1) if (choose_image == 0): image = Image.open('resources/wineconnaisseur_1.png') st.image(image, use_column_width=True) else: image = Image.open('resources/wineconnaisseur_3.png') st.image(image, use_column_width=True) else: st.write( "bad quality wine! Do yourself a favor and throw away this thing you call wine...." ) image = Image.open('resources/wineconnaisseur_2.png') st.image(image, use_column_width=True) if (connaisseur_choice == "The logistic regression connaisseur"): st.write("The logistic regression connaisseur verdict: ") if (prediction_log_reg == 1): st.write( "Good quality wine! This wine is at least a 7 in my expert opinion. You got great test!" ) choose_image = randrange(1) if (choose_image == 1): image = Image.open('resources/wineconnaisseur_1.png') st.image(image, use_column_width=True) else: image = Image.open('resources/wineconnaisseur_3.png') st.image(image, use_column_width=True) else: st.write( "bad quality wine! Do yourself a favor and throw away this thing you call wine...." ) image = Image.open('resources/wineconnaisseur_2.png') st.image(image, use_column_width=True) # end tracking code block streamlit_analytics.stop_tracking()
) #.facet(row=alt.Row('1figr Tier:N'))#, sort=['1','2','4','5']))#.add_selection(selection1) # st.altair_chart( # alt.vconcat( # CPU_2020_with_1figrTier.encode(color="1figr:Q"), # CPU_2020_with_1figrTier.encode(color="1figr:N"), # CPU_2020_with_1figrTier.encode(color="1figr:O") # ) # ) st.altair_chart(CPU_2020_with_1figrTier) #, use_container_width=True) ##### Footer in sidebar ##### #html_string = "<p style=font-size:13px>Created by Eric Schares, Iowa State University <br />If you found this useful, or have suggestions or other feedback, please email [email protected]</p>" #st.sidebar.markdown(html_string, unsafe_allow_html=True) streamlit_analytics.stop_tracking(unsafe_password="******") # # Analytics code # components.html( # """ # <html> # <body> # <script>var clicky_site_ids = clicky_site_ids || []; clicky_site_ids.push(101315881);</script> # <script async src="//static.getclicky.com/js"></script> # <noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/101315881ns.gif" /></p></noscript> # </body> # </html> # """ # ) # components.html(
idade = df[filtro]['idade'].iloc[0] if tipo == 'Presencial': valor = df[filtro]['valor_presencial_'+str(dict_niveis[nivel])].iloc[0] elif tipo == "Online": valor = df[filtro]['valor_online_'+str(dict_niveis[nivel])].iloc[0] #if st.checkbox(str(nome), False): st.markdown("__Valor hora aula:__ R$ " + str(valor)) st.markdown("__Titulo:__ " + str(titulo)) st.markdown("__Metodologia:__ " + str(metodologia)) st.markdown("__Motivação:__ " + str(motivacao)) st.markdown("__Currículo:__ " + str(curriculo)) st.markdown("__Idade:__ " + str(idade)) t = '*Mensagem no Zap de ' +str(nome.split(" ")[0])+ '*' link = f'[{t}]({link_zap})' st.markdown(link, unsafe_allow_html=True) # Enviar email acesso prof date_time = datetime.now().strftime("%d/%m/%Y, %H:%M:%S") enviar_email_prof(date_time,aluno, contato,nivel,materia,tipo, cidade, genero,str(nome)) elif flag == 1: st.markdown("Nenhum professor nessa faixa de valores :cry:") else: st.markdown("Aguardando o preenchimento das preferências :sleeping:") #streamlit_analytics.stop_tracking(save_to_json="C:/Users/pedro/Dropbox/Bizu/metrics.json") streamlit_analytics.stop_tracking()
def references(): references = """ # References <sup>Borry, M., Cordova, B., Perri, A., Wibowo, M., Honap, T. P., Ko, J., Yu, J., Britton, K., Girdland-Flink, L., Power, R. C., Stuijts, I., Salazar-Garc ́ıa, D. C., Hofman, C., Hagan, R., Kagon ́e, T. S., Meda, N., Carabin, H., Jacobson, D., Reinhard, K., Lewis, C., Kostic, A., Jeong, C., Herbig, A., Huebner, A.,and Warinner, C. (2020). Coproid predicts the source of coprolites and paleofeces using microbiome composition and host dna content.PeerJ, 8:e9001. Publisher: PeerJ Inc.</sup> <sup>Nurk, S., Meleshko, D., Korobeynikov, A., and Pevzner, P. A. (2017). metaspades: a new versatile metagenomic assembler.Genome research, 27(5):824–834.</sup> <sup>Wibowo, M. C., Yang, Z., Borry, M., H ̈ubner, A., Huang, K. D., Tierney, B. T., Zimmerman, S., Barajas-Olmos, F., Contreras-Cubas, C., Garcia-Ortiz, H., Martinez-Hernandez, A., Luber, J. M., Kirstahler, P.,Blohm, T., Smiley, F. E., Arnold, R., Ballall, S. A., Pamp, S. J., Russ, J., Maixner, F., Rota-Stabelli, O.,Segata, N., Reinhard, K., Orozco, L., Warinner, C., Snow, M., LeBlanc, S., and Kostic, A. D. (2021). Reconstruction of ancient microbial genomes from the human gut. Nature</sup> """ st.markdown(references, unsafe_allow_html=True) if __name__ == "__main__": pwd = os.environ.get("STAT_PASSWORD") streamlit_analytics.start_tracking() print_header() print_title() flash_talk() game_intro() introduction() methods() results() conclusion() references() if pwd: streamlit_analytics.stop_tracking(unsafe_password=pwd) else: streamlit_analytics.stop_tracking()