Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
|
6 |
+
#----------------------
|
7 |
+
Menu=['Home','News','Report']
|
8 |
+
choise=st.sidebar.selectbox('Menu',Menu)
|
9 |
+
if choise=='Home' :
|
10 |
+
st.title('Welcome to Home Page')
|
11 |
+
|
12 |
+
elif choise=='News' :
|
13 |
+
st.title('Welcome to News page')
|
14 |
+
tt = st.text_input('اخبار کدام تیم را دنبال می کنید؟')
|
15 |
+
st.markdown('<style>.block-container {direction : rtl}</style>',
|
16 |
+
unsafe_allow_html=True)
|
17 |
+
r = requests.get(f'https://search-api.varzesh3.com/v1.0/query?q={tt}')
|
18 |
+
x = r.json()
|
19 |
+
st.title('اخبار ورزشی')
|
20 |
+
for i in x['news']:
|
21 |
+
st.subheader(i['title'])
|
22 |
+
st.success(i['publishedOn'])
|
23 |
+
st.write(i['shortDescription'])
|
24 |
+
st.warning(i['viewCount'])
|
25 |
+
st.image(i['picture'])
|
26 |
+
st.write('---------------------')
|
27 |
+
else :
|
28 |
+
st.title('Welcom to Report page')
|