awacke1's picture
Update app.py
09c2c65
raw
history blame
2.16 kB
import streamlit as st
import gradio as gr
import IPython
import streamlit as st
import streamlit.components.v1 as components
from IPython.display import IFrame
src='' # URL parameter to change the iframe url
def SetIframeURL(option_selected):
if (option_selected=='Collager'):
src='https://www.artbreeder.com/beta/collage'
if (option_selected=='Midjourney'):
src='https://www.midjourney.com/app/users/779773261440614430/'
if (option_selected=='DreamStudio'):
src='https://beta.dreamstudio.ai/dream'
if (option_selected=='NightCafe'):
src='https://creator.nightcafe.studio/explore'
if (option_selected=='RunwayML'):
src='https://app.runwayml.com/'
width = st.sidebar.slider("Width", 200, 1500, 800, 100)
height = st.sidebar.slider("Height", 200, 1500, 900, 100)
st.components.v1.iframe(src, width, height, scrolling=True)
try:
options = ['Collager', 'Midjourney', 'DreamStudio', 'NightCafe', 'RunwayML']
query_params = st.experimental_get_query_params()
query_option = query_params['option'][0] #throws an exception when visiting http://host:port
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
if option_selected:
st.experimental_set_query_params(option=option_selected)
SetIframeURL(option_selected)
except:
options = ['Collager', 'Midjourney', 'DreamStudio', 'NightCafe', 'RunwayML']
st.experimental_set_query_params(option=options[1]) # defaults to dog
query_params = st.experimental_get_query_params()
query_option = query_params['option'][0]
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
if option_selected:
st.experimental_set_query_params(option=option_selected)
SetIframeURL(option_selected)
def LoadGradioAIModels():
title = "Image Generation for Art, Marketing, Ideation, Design, and Use in Business"
description = "Image Generation for Art, Marketing, Ideation, Design, and Use in Business"
article = "<p style='text-align: center'></p>"
examples = [[""]]