File size: 1,699 Bytes
0449aa7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: Drawdata Sklearn
emoji: 🌍
colorFrom: indigo
colorTo: gray
sdk: docker
pinned: false
license: mit
---

# drawdata - demo using solara

[Drawdata](https://github.com/koaning/drawdata) is an ipywidget library build using [anywidget](https://github.com/manzt/anywidget).

All ipywidgets (and also anywidget) run in the Jupyter notebook, but also in [Solara server](https://solara.dev/).

Solara server can run Python code and notebooks, and display [regular widgets](https://solara.dev/docs/tutorial/ipywidgets),
or for more production quality code, [solara components](https://solara.dev/docs/fundamentals/components).

## Demo 1 - Original with classic widgets

This demonstrates solara server can execute the ([almost unmodified](https://github.com/widgetti/solara/issues/539)) [notebook](https://github.com/probabl-ai/youtube-appendix/blob/main/04-drawing-data/notebook.ipynb).

Since ipywidgets lacks lifetime management, the widgets in this tab are kept alive and reused when moved back to this tab (try drawing, and switch tabs).

This demo shows how drawdata can be used exploring how different sklearn algorithm perform on datasets draw by hand ([YouTube video](https://www.youtube.com/watch?v=STPv0jSAQEk))


## Demo 2 - Fancy demo using components

For larger apps and dynamic UI's it pays off using [components](https://solara.dev/docs/fundamentals/components) and creating elements
instead of directly creating widgets. This makes it possible to create very dynamic UIs (try changing the layout using the top right button in the app bar)
and have proper life cycle management (widgets get cleaned up when changing tabs, freeing memory - very important in larger applications)