Spaces:
Runtime error
Runtime error
Upload 15_Picture.py
Browse files- pages/15_Picture.py +33 -0
pages/15_Picture.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import yfinance as yf
|
| 4 |
+
import streamlit.components.v1 as components
|
| 5 |
+
from requests_html import HTMLSession
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
st.set_page_config('Picture',":tent:","wide",menu_items={'About': "This is an *extremely* cool app!"})
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
menu=['Find picture']
|
| 15 |
+
ch=st.sidebar.selectbox('Menu',menu)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
if 'Find picture' in ch:
|
| 19 |
+
with st.container():
|
| 20 |
+
st.title('Search and download your picturs here!')
|
| 21 |
+
ti=st.text_input('Search')
|
| 22 |
+
if len(ti)>0:
|
| 23 |
+
r=requests.get('https://unsplash.com/napi/search?query='+ti+'&per_page=100&xp=')
|
| 24 |
+
x=r.json()
|
| 25 |
+
for i in x['photos']['results']:
|
| 26 |
+
with st.container():
|
| 27 |
+
lc , rc = st.columns(2)
|
| 28 |
+
with lc:
|
| 29 |
+
st.image(i['urls']['small'])
|
| 30 |
+
with rc:
|
| 31 |
+
st.subheader('Download link')
|
| 32 |
+
st.write(i['links']['download'])
|
| 33 |
+
st.write('---')
|