Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -158,7 +158,7 @@ def main():
|
|
158 |
with st.sidebar:
|
159 |
st.image(side_img, width=300)
|
160 |
st.sidebar.subheader("Menu")
|
161 |
-
website_menu = st.sidebar.selectbox("Menu", ("Emotion Recognition", "Project description"
|
162 |
st.set_option('deprecation.showfileUploaderEncoding', False)
|
163 |
|
164 |
if website_menu == "Emotion Recognition":
|
@@ -444,37 +444,7 @@ def main():
|
|
444 |
st.plotly_chart(fig, use_container_width=True)
|
445 |
|
446 |
else:
|
447 |
-
|
448 |
-
import json
|
449 |
-
|
450 |
-
url = 'http://api.quotable.io/random'
|
451 |
-
if st.button("get random mood"):
|
452 |
-
with st.container():
|
453 |
-
col1, col2 = st.columns(2)
|
454 |
-
n = np.random.randint(1, 1000, 1)[0]
|
455 |
-
with col1:
|
456 |
-
quotes = {"Good job and almost done": "checker1",
|
457 |
-
"Great start!!": "checker2",
|
458 |
-
"Please make corrections base on the following observation": "checker3",
|
459 |
-
"DO NOT train with test data": "folk wisdom",
|
460 |
-
"good work, but no docstrings": "checker4",
|
461 |
-
"Well done!": "checker3",
|
462 |
-
"For the sake of reproducibility, I recommend setting the random seed": "checker1"}
|
463 |
-
if n % 5 == 0:
|
464 |
-
a = np.random.choice(list(quotes.keys()), 1)[0]
|
465 |
-
quote, author = a, quotes[a]
|
466 |
-
else:
|
467 |
-
try:
|
468 |
-
r = requests.get(url=url)
|
469 |
-
text = json.loads(r.text)
|
470 |
-
quote, author = text['content'], text['author']
|
471 |
-
except Exception as e:
|
472 |
-
a = np.random.choice(list(quotes.keys()), 1)[0]
|
473 |
-
quote, author = a, quotes[a]
|
474 |
-
st.markdown(f"## *{quote}*")
|
475 |
-
st.markdown(f"### ***{author}***")
|
476 |
-
with col2:
|
477 |
-
st.image(image=f"https://picsum.photos/800/600?random={n}")
|
478 |
|
479 |
|
480 |
if __name__ == '__main__':
|
|
|
158 |
with st.sidebar:
|
159 |
st.image(side_img, width=300)
|
160 |
st.sidebar.subheader("Menu")
|
161 |
+
website_menu = st.sidebar.selectbox("Menu", ("Emotion Recognition", "Project description"))
|
162 |
st.set_option('deprecation.showfileUploaderEncoding', False)
|
163 |
|
164 |
if website_menu == "Emotion Recognition":
|
|
|
444 |
st.plotly_chart(fig, use_container_width=True)
|
445 |
|
446 |
else:
|
447 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
|
449 |
|
450 |
if __name__ == '__main__':
|