SantoshKumar commited on
Commit
a29cf0f
1 Parent(s): 7ded7ae

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import gradio as gr
3
+ import IPython
4
+ import streamlit as st
5
+ import streamlit.components.v1 as components
6
+ from IPython.display import IFrame
7
+
8
+ src='' # URL parameter to change the iframe url
9
+ def 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
+
29
+ try:
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:port
33
+ 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)
37
+ except:
38
+ options = ['Midjourney', 'RunwayML', 'Boomy']
39
+ st.experimental_set_query_params(option=options[1]) # defaults to 1
40
+ 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)