Form widget with options updated automatically and interactively

Hi, everyone!
I’m developing an app with Streamlit and I need some help with the multiselect and form input widget.

GitHub repository.
Streamlit script.
Python version: 3.6.10
Streamlit version: 1.5.0

The goal of my app is to visualize and explore Word2Vec word embeddings (text representation models) trained with articles about Acute Myeloid Leukemia.

The app works this way: the user can choose between the pre-loaded models present in the app or upload a new one. Then, the user can manipulate some features of the selected model, like the vocabulary domain (removing words that do not belongs to an specific domain), remove some common English words, choose the number of dimensions to be ploted (2D or 3D)…

Anyway, the last and more important thing that the user can do is to write target words (with the text input widget) to be searched and ploted (in the central/main area of the app). After searching for a word, the app shows dot and bar charts with the words near to the input, a table with the relatively distance of the words and some base-words. Finally, at the end of the main window, the app shows to the user a forms with N columns (N is equal to the number of words written by the user) and the words nearest to each input, so the user can select this words to be searched and explored in the model. This form should change the options interactively, as the user changes the words to be searched.

For example, with the user types ‘cytarabine’ and ‘venetoclax’ in the text input field, the app returns:

And then, if the user select (in the form) other words like ‘mitoxantrone’, ‘bortezomib’ and ‘gilteritnib’, the app reload and correctly plot these new words. But I could not make the same thing with the form, I would like that the form updates the options, giving the user the opportunity to “go deep” and explore the model, changing the target words infinite times.

Can someone can help me with this?