https://www.dropbox.com/s/fipykgf6bugtuxc/amwtmu_demo.gif?dl=0
Download the gif and play it.
import requests | |
import streamlit as st | |
state = st.session_state | |
if 'flask_started' not in state: | |
state.flask_started = False | |
def start_flask(): | |
if state.flask_started: | |
return |
from itertools import cycle | |
import streamlit as st | |
num_cols = int(st.sidebar.number_input('Number columns', 1, 7, 3, 1)) | |
img_w = int(st.sidebar.number_input('Image width', 50, 500, 150, 10)) | |
images = { | |
'https://unsplash.com/photos/-YHSwy6uqvk/download?force=true&w=640': 'Feast', | |
'https://unsplash.com/photos/UC0HZdUitWY/download?force=true&w=640': 'Mixed Grill', |
# My solution for: https://discuss.streamlit.io/t/how-to-update-st-columns/25501/3 | |
# This uses a button callback to report the enroll action. Notice how all the widget keys are | |
# generated so they are unique. To deal with being able to edit the values from their defaults, | |
# and report on them correctly, I am printing out the widgets’ session state values. | |
# UPDATE: Added continuous update of the students list | |
import streamlit as st | |
from dataclasses import dataclass | |
import time | |
import random |
# My solution for: https://discuss.streamlit.io/t/how-to-update-st-columns/25501/3 | |
# This uses a button callback to report the enroll action. Notice how all the widget keys are | |
# generated so they are unique. To deal with being able to edit the values from their defaults, | |
# and report on them correctly, I am printing out the widgets’ session state values. | |
import streamlit as st | |
from dataclasses import dataclass | |
state = st.session_state |
# 2 range sliders | no value overlap | clamped values | |
import streamlit as st | |
state = st.session_state | |
def _set_x_cb(): | |
if state.x[1] > state.y[0]: | |
state.x = (state.x[0], state.y[0]) | |
def _set_y_cb(): | |
if state.y[0] < state.x[1]: |
# Based on discussion here: https://discuss.streamlit.io/t/how-to-work-date-input-with-shortcuts/25377/3 | |
import streamlit as st | |
from datetime import datetime as dt | |
import calendar | |
state = st.session_state | |
if 'message' not in state: | |
state.message = '' |
def can_use_streamlit(): | |
""" | |
Function to check whether python code is run within streamlit | |
Requires Streamlit>=1.9.0 | |
Returns | |
------- | |
can_use_streamlit : boolean | |
True if code is run within streamlit, else False |
# Generic answer to this question: https://discuss.streamlit.io/t/how-to-work-date-input-with-shortcuts/25377 | |
import streamlit as st | |
state = st.session_state | |
def _set_start_cb(): | |
if state.start > state.end: | |
state.start = state.end | |
def _set_end_cb(): | |
if state.end < state.start: |
# My solution to this: https://discuss.streamlit.io/t/the-if-else-appear-anyway/24713/7 | |
import streamlit as st | |
import spacy | |
from spacy import displacy | |
from spacy.matcher import PhraseMatcher | |
nlp = spacy.load('en_core_web_sm') #some alternatives en_core_web_md, en_core_web_lg | |
nlp.disable_pipes('ner') |
https://www.dropbox.com/s/fipykgf6bugtuxc/amwtmu_demo.gif?dl=0
Download the gif and play it.