Skip to content

Instantly share code, notes, and snippets.

@mengwangk
Created December 29, 2020 09:50
Show Gist options
  • Select an option

  • Save mengwangk/baedbe51cd8136fc85ec6c2465e70008 to your computer and use it in GitHub Desktop.

Select an option

Save mengwangk/baedbe51cd8136fc85ec6c2465e70008 to your computer and use it in GitHub Desktop.
Serving ML models - PGAN front end
import io
import requests
import streamlit as st
from PIL import Image
server_url=f"http://backend:8088/pgan"
def pgan():
st.title("PGAN - Progressive Growing of GANS")
st.write(
"""Serving PGAN model using FastAPI and Streamlit."""
)
if st.button("Generate"):
res = requests.get(server_url)
pgan_image = Image.open(io.BytesIO(res.content))
col1, col2 = st.beta_columns(2)
col1.header("PGAN Image")
col1.image(pgan_image, use_column_width=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment