CoolFace
Apppublic

Wanli/WMa_First_Space_06

sourceHugging Faceopenrailupdated 4y agoView on Hugging Face
0likes
app.py45 linesDownload Raw Back to root
1import streamlit as st      2import gradio as gr3import IPython4import streamlit as st5import streamlit.components.v1 as components6from IPython.display import IFrame7 8src=''   # URL parameter to change the iframe url9def SetIframeURL(option_selected):10    if (option_selected=='Collager'):11        src='https://www.artbreeder.com/'12    if (option_selected=='Midjourney'):13        src='https://www.midjourney.com/'14    if (option_selected=='DreamStudio'):15        src='https://beta.dreamstudio.ai/'16    if (option_selected=='NightCafe'):17        src='https://creator.nightcafe.studio/'18    if (option_selected=='RunwayML'):19        src='https://app.runwayml.com/'20    if (option_selected=='ArtFromTextandImages'):21        src='https://huggingface.co/spaces/awacke1/Art-from-Text-and-Images'   22    if (option_selected=='Boomy'):23        src='https://boomy.com/'   24    25    width = st.sidebar.slider("Width", 200, 1500, 800, 100)26    height = st.sidebar.slider("Height", 200, 1500, 900, 100)27    st.components.v1.iframe(src, width, height, scrolling=True)28 29try:30    options = ['Midjourney', 'RunwayML', 'Boomy']31    query_params = st.experimental_get_query_params()32    query_option = query_params['option'][0] #throws an exception when visiting http://host:port33    option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))34    if option_selected:35        st.experimental_set_query_params(option=option_selected)36        SetIframeURL(option_selected)37except: 38    options = ['Midjourney', 'RunwayML', 'Boomy']39    st.experimental_set_query_params(option=options[1]) # defaults to 140    query_params = st.experimental_get_query_params()41    query_option = query_params['option'][0]42    option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))43    if option_selected:44        st.experimental_set_query_params(option=option_selected)45        SetIframeURL(option_selected)