Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,8 +12,17 @@ import requests
|
|
| 12 |
|
| 13 |
st.set_page_config(page_title="Stock News Sentiment Analyzer", layout="wide")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
def verify_link(url, timeout=10, retries=3):
|
| 16 |
-
for _ in
|
| 17 |
try:
|
| 18 |
response = requests.head(url, timeout=timeout, allow_redirects=True)
|
| 19 |
if 200 <= response.status_code < 300:
|
|
@@ -170,4 +179,4 @@ hide_streamlit_style = """
|
|
| 170 |
footer {visibility: hidden;}
|
| 171 |
</style>
|
| 172 |
"""
|
| 173 |
-
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
|
|
|
| 12 |
|
| 13 |
st.set_page_config(page_title="Stock News Sentiment Analyzer", layout="wide")
|
| 14 |
|
| 15 |
+
# Function to allow all CORS and permissions, managed typically by your server or hosting service.
|
| 16 |
+
def set_headers():
|
| 17 |
+
st.write("<head>")
|
| 18 |
+
st.write("""<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com 'https://*'; connect-src * ws://localhost:* wss://localhost:*">""")
|
| 19 |
+
st.write("<meta http-equiv='Access-Control-Allow-Origin' content='*'>")
|
| 20 |
+
st.write("</head>")
|
| 21 |
+
|
| 22 |
+
set_headers()
|
| 23 |
+
|
| 24 |
def verify_link(url, timeout=10, retries=3):
|
| 25 |
+
for _ in retries:
|
| 26 |
try:
|
| 27 |
response = requests.head(url, timeout=timeout, allow_redirects=True)
|
| 28 |
if 200 <= response.status_code < 300:
|
|
|
|
| 179 |
footer {visibility: hidden;}
|
| 180 |
</style>
|
| 181 |
"""
|
| 182 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|