mhan commited on
Commit
9398ada
1 Parent(s): 7f83513

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import streamlit as st
4
+ import streamlit.components.v1 as components
5
+
6
+ st.set_page_config(layout="wide")
7
+
8
+ # Message for users
9
+ st.markdown("""
10
+ **Notice**: If you encounter any issues opening the demo or using the chatbot, try reloading the page which would reschedule a new demo instance.
11
+ Please report the issues [here](https://huggingface.co/spaces/mhan/Shot2Story/discussions/1).
12
+ We will respond ASAP.
13
+
14
+
15
+ """)
16
+
17
+ # List of backend URLs
18
+ backends = ["backend1", "backend2"]
19
+
20
+ # Randomly select a backend URL
21
+ backend = random.choice(backends)
22
+ backend_url = os.getenv(backend, "https://www.bytedance.com/en/") # 如果环境变量不存在,则使用默认 URL
23
+
24
+ iframe_html = f'<iframe src="{backend_url}" width="100%" height="800"></iframe>'
25
+
26
+ components.html(iframe_html, height=800)