Skip to content

Instantly share code, notes, and snippets.

@mika-rafie
Last active March 30, 2022 15:41
Show Gist options
  • Save mika-rafie/9d137957f078169b263182144d785cc3 to your computer and use it in GitHub Desktop.
Save mika-rafie/9d137957f078169b263182144d785cc3 to your computer and use it in GitHub Desktop.
import os
from urllib.request import urlopen
import streamlit as st
from keras_model import model # your custom model
my_email = st.secrets['email']
model_weight_file = st.secrets['model_url']
if not os.path.exists('./best_weights.h5'):
u = urlopen(model_weight_file)
data = u.read()
u.close()
with open('best_weights.h5', 'wb') as f:
f.write(data)
...
model = model.load_weights('best_weights.h5')
...
st.write(f'My email is {my_email}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment