solara
solara copied to clipboard
feature request: Spinner/Loader on "use_thread"
Hi!
I suggest that we add a mode where a spinner is automatically applied whenever one uses use_thread. This could potentially be
- An input variable
- A new function (e.g.
use_thread_and_load)
I write a lot of code where I wrap this, i.e.
df = solara_run_inference.use_thread(
Path(model),
Path(file),
aggregate_duration=10,
)
if df.state == solara.ResultState.RUNNING:
Progress("Running...")
elif df.state == solara.ResultState.FINISHED:
DfSelector(df.value, file)
and it's starting to be quite ugly as it's in multiple places.
Hi Hampus,
we totally recognize this boilerplate issue, but I didn't yet come up with a solution that was satisfying and something I would feel comfortable in solara. What about a custom component that takes the function to run in the thread as an argument? Would that work?
Regards,
Maarten
Hi Hampus,
we totally recognize this boilerplate issue, but I didn't yet come up with a solution that was satisfying and something I would feel comfortable in solara. What about a custom component that takes the function to run in the thread as an argument? Would that work?
Regards,
Maarten
Hi!
That's a sound approach. The Streamlit approach is also a smooth one (using with context), alas it isn't compatible with the Solara way of execution.
I'll see if I can make a mini-component to share 👍
BR, Hampus
Still not fully solved, but at least task is an improvement. Closing for now. 👍
Sorry for keeping this open. We've been working on this internally a bit, but it was difficult to make something general. Keeping it open for a reminder, I think it would be good to have a good pattern for this.