[{"content":"","date":"2025-08-30T00:00:00Z","permalink":"/p/streamlit-test2/","title":"Another Attempt at Embedding Apps"},{"content":"Here is a first attempt at getting Streamlit apps embedded on this webpage. If you\u0026rsquo;re unsure why this is amazing, let me explain the difference between static pages and dynamic ones. Intuitively, a static page is the same for every visitor, supports only limited interactivity, and is stored as-is on the server. It loads quickly and is so easy to host that it is completely free on many platforms. That way, to get a personal website like this one, you\u0026rsquo;d only need to pay for the DNS.\nDynamic pages are a bit different. There are server-side computations going on and served to the webclient in real-time. Typically all websites that do a bit more than just offering pages to read, such as social media platforms, e-shops, personalized user pages, and any interactivity beyond that would require dynamic content. This server has to perform more computations than just picking out the right files to send, and so usually require more set-up and come at a price.\nBy being able to embed dynamic content on a static page, the dynamic content can be hosted elsewhere and the interactivity still served to your website. Think for example of showing YouTube videos or ads on your webpage. The external content is loaded in dynamically when a user visits your site, while the internal content is displayed as-is. This is especially important for me because many of the projects I would want to showcase on my website require AI models or interactive data visualizations. The PAC Winrate plot for example was directly exported as code, and the data is hardcoded in with the page. The Nerve Growth Simulation is actually in 3D but I found no way to host an interactive 3D plot with this many datapoints on a static page.\nThrough embedding this content, I can show more (and more fun!) content in an interactive format, close to what the project is actually about. In this post I will be showcasing an example webapp I built as part of another application process. The model was already provided, the task was to do a code review on it, demo it with a webapp, and propose a future, improved, and more complete architecture. Here is the webapp in action:\nOops! Not all features integrate as nicely. Most notable, the callbacks for authentication breaks when running in embedded mode. Furthermore, it does not respond to the light/dark mode toggle on my website. Finally, if the page is unused for a while, Streamlit takes the container that runs the app down. This means the server essentially has to be restarted for the next visitor, which can take 5-10 minutes. It\u0026rsquo;s very likely that this has happened to you just now (and then you got disappointed that you cannot login\u0026hellip;)!\nSo what\u0026rsquo;s the solution? Well, the easiest answer is: Don\u0026rsquo;t worry about it. Running and hosting Streamlit apps is essentially free for my usecase, so it should be fine even without authentication. The light/dark mode is a bit of a pain, maybe I\u0026rsquo;ll look at having a transparent background (that can dynamically be applied when running in embedded mode?). But it is by no means a dealbreaker. And it is the same with launching the app. Sure, it takes some time. But the project is there and can be easily accessed, even if it takes some waiting. For now, that is sufficient. If there\u0026rsquo;s ever a need to move a project to be permanently available, I can always just spin up an instance on AWS.\n","date":"2025-08-26T00:00:00Z","image":"/p/streamlit-test/streamlit.jpg","permalink":"/p/streamlit-test/","title":"Embedding a Dynamic WebApp"},{"content":"My partner and I wanted pets for as long as we\u0026rsquo;ve been together. Unfortunately, along with having pesky things such as \u0026ldquo;consideration for your pet\u0026rdquo; and \u0026ldquo;a moral compass\u0026rdquo; comes the desire for responsbible ownership. These little critters would be entirely dependent on us for hopefully many many years, and so this was not a decision we could take lightly. Up until recently, our situation was such that we would be out of house for irregular and long stretches at a time. Furthermore, we moved a lot due to studies \u0026amp; career.\nNow that we are settling a bit more in Switzerland, and I had a fully remote position, we decided that it was finally time for a pet. Initially we were thinking of adopting a retired greyhound; a cat was not on the radar at all. But the danger in looking for pets online is that you will find pets online. And so we found a listing for Kafi (who was not yet named Kafi at the time)! Kafi was the smallest of the litter, being the 7th, and instantly captured our hearts. He\u0026rsquo;s a pure \u0026ldquo;Traditional Siamese\u0026rdquo; from a healthy lineage.\nEven though the \u0026ldquo;Thai\u0026rdquo; breed is natural and much closer to the original Siamese cat, officially \u0026ldquo;Siamese\u0026rdquo; is a name reserved for the highly selected western style modern breed. As such, to be correct (in the eyes of cat associations), we cannot call Kafi a Siamese. Thankfully, he\u0026rsquo;s our cat and we don\u0026rsquo;t need to be correct. Important to us was that, if we are not going to adopt from a shelter, we wanted the newly born kitten to have the best chances at a happy and healthy life.\nOne thing that immediately stood out is how calm and accepting he was. He likes to be picked up, appreciates his paws being held, more than tolerates having his nails clipped, and will instantly warm up to anyone. Surprisingly, he\u0026rsquo;s more cautious around other cats than humans! His love for cuddling and acceptance to touch is likely also in parts of how we raised him. From day one we\u0026rsquo;d make a habit of holding him and massaging his paws as he slept. Another part is that he gets frequent activity. He has a wall dedicated with climbing obstacles, and especially loves chasing (and fetching) long pieces of rope.\nAs he\u0026rsquo;s an indoors cat, it\u0026rsquo;s important to us that he gets plenty of exercise. Usually when we play with him, he will continue by himself for a while. He also has a handful of cotton balls that he loves playing football with. He\u0026rsquo;s a natural, and much better at it than I am. We leash trained him, and he seems to especially like wearing his harness (perhaps because of his association with getting treats). However, he hates going outside with us unless it\u0026rsquo;s very warm, and then he mostly just sniffs around before sunbathing. Thankfully our balcony is like a solar powered oven even in winter, so he can catch some rays when he really needs to.\nBeyond how extremely affectionate and lovable he is, Kafi also often makes us laugh because of how unwittingly silly he can be. For some reason he doesn\u0026rsquo;t really meow, but he has this higher pitched peeps and mews. He uses that to tell us he missed us when we come back from shopping, to tell us how proud he is of how stinky he made his litter box, when he wants to go onto the balcony, and when he wants to eat. He gets canned, grain/sugar free wet food, as we learnt that this is healthier for their kidneys in the long term. Cats generally drink too little, and rely on getting moisture through their food. Having a diet consisting of only dry food can as such cause kidney problems in the long term. We\u0026rsquo;ve also noticed that he\u0026rsquo;s much less gluttonous with wet food. He only eats as much as he needs, and we\u0026rsquo;ve never had to restrict his diet in any way. We put out a spoonful of dry food at night for him to snack on, but he often doesn\u0026rsquo;t even finish it and wants to enjoy wet food for brunch (he likes to sleep in).\nIf you\u0026rsquo;ve read all that, you must be a die-hard Kafi fan just like we are. So here\u0026rsquo;s one final eepy sleepy Kafi just for you!\n","date":"2025-03-03T00:00:00Z","image":"/p/kafi/kafi_banner.jpg","permalink":"/p/kafi/","title":"Meet Kafi"},{"content":"As part of a job application I was asked to consider features for a 3D scan of the subepidermal nerve plexus. However, rather than just looking through the literature, I thought it would be fun to also implement some of them. Unfortunately at this stage in the application process, I do not yet have access to the data. So I thought to generate my own!\nThis has various benefits, the predominant one that we can use the simulation to understand our features better. Let\u0026rsquo;s say we have a feature which describes the branching factor of the nerves. Then for a certain volume inside the scan (our real data), we find that the branching factor is 0.45. What does this mean? With a simulation, we could visually describe \u0026amp; interpret our features. We can have a progression from 0. to 1. branching factor, giving a much more obvious feeling for what a branching factor of 0.45 means.\nThe simulation is a vast oversimplification, but it\u0026rsquo;s easy to expand on. As of now, we can control things like thickness, spread \u0026amp; growth direction, and how much it branches. In the future I would like to add additional simulation options such as bundling of multiple fine nerves, and better controls for visualization. Either way, this is enough to at least get a first look at what the simulation looks like!\nMy implementation is roughly based on this implementation of space colonization in 2D. As you can see, it has a very nice \u0026ldquo;natural\u0026rdquo; feel to it, although it\u0026rsquo;s still far from realistic nerve growth. Still, it should suffice for a proof of concept of some features to describe 3D nerve topology!\n","date":"2025-02-27T00:00:00Z","image":"/p/application-usz/nerves1.jpg","permalink":"/p/application-usz/","title":"3D \"Nerve growth\" Simulation"},{"content":"Me and Nanolive Between 2022 and 2023 I spend just over half a year at the startup Nanolive, a startup bringing a unique approach to cell biology. Traditional microscopy typically separates acquisition and analysis as two separate steps, but Nanolive combines them into a unified, AI-powered solution. Advanced image analysis with (pre)trained ML/DL models often suffer if the image acquisition procedure is systemically different from that seen in the training data. Digital image analysis solutions often have to work on a wide range of noise signatures, optical aberrations, resolution differences, and much more. Nanolive\u0026rsquo;s 2-for-1 package addresses this by standardizing the microscopy process, creating a robust platform for the included downstream analysis.\nAs part of the Deep Quantitative Biology team, Nanolive\u0026rsquo;s core R\u0026amp;D team, one of my core responsiblities was to develop an optimization platform. The team has exclusive access to their own wet lab and utilizes a combination of fluorescent labeling and manual labeling / label correction on an ih-house labelling platform to train cutting-edge segmentation models. The optimization platform was to take in previously existing models and data, and to then explore subsamples, settings, and hyperparameter space, to optimize our models and automatically generate performance reports. This allowed us to identify potential weaknesses of our models, but also to spend labelling efforts only where they would be most impactful.\nTheir Publication Needless to say, I was thrilled to see my old team\u0026rsquo;s latest publication: Dynamic label-free analysis of SARS-CoV-2 infection reveals virus-induced subcellular remodeling. Their unique position in the field allowed them to reach findings few other labs could: using Nanolive\u0026rsquo;s label-free methodology, high quantities of live cells can be analyzed over a much longer period of time than competing technologies. Let\u0026rsquo;s summarize who contributed, what their findings are and why this is valuable:\nSummary WHO Pasteur Institute\u0026rsquo;s Virus \u0026amp; Immunity Unit and Nanolive\u0026rsquo;s Deep Quantitative Biology team. Together, they bring strong virology expertise and a high-throughput, label-free methodology.\nWHAT The authors analyze how SARS-CoV-2 impacts subcellular structures and internal cell dynamics, showing how the virus modifies cells to boost its own production and delay the host’s immune response. They further demonstrate the robustness of their ML segmentation despite the numerous challenges with establishing a ground truth in this space. This is then used to compare the organelle dynamics over two days for infected samples and non-infected control cells. Anyone familiar with the field will be aware that measuring hundreds of live cells over this large time-span while quantifying sub-cellular dynamics is a feat on its own! The authors further identify time-windows of the numerous effects of SARS-CoV-2 on the infected host, resolving conflicts in the existing literature. Finally, Bayesian networks for infected cells compared to control classes, show that SARS-CoV-2 strongly affects the process through which lipid droplets are produced.\nHOW Standard microscopy either lacks resolution or damages live cells, but Nanolive’s holotomography (HT) creates a 3D refractive index tomogram. This process, conceptually similar to a CT scan, yields high resolution output without damaging the cell. Nanolive is the first company to make microscopy solutions based on the HT principle commercialy available. Normally, staining or other markers would have to be added to label cells. Unfortunately, this damages the cell and can influence the inner cell dynamics. Manual labelling effort would be required to avoid using damaging agents, but this human involvement typically limits the amount of cells that can be quantified and analyzed. By using ML-based segmentation, hundreds of living cells and subcellular dynamics can be tracked over hours and even days.\nWHY Understanding the subcellular changes during SARS-CoV-2 infection sheds light on its lifecycle and clarifies previously conflicting data by showing it varies over time. This paper is a big step forward in high-throughput, high-resolution analysis of cellular dynamics and demonstrates the potential of Nanolive’s innovative approach.\nConclusion Working alongside my former colleagues at Nanolive was truly a privilege. They’re some of the most dedicated, talented, and genuinely pleasant people I’ve had the opportunity to meet. Their commitment to pushing the boundaries of cell biology at Nanolive shines through in this latest publication. It’s rewarding to see even a small part of my work contribute to such impactful findings. I’m confident that with their skills and vision, there’s a bright future ahead for the team and the field of high-resolution, high-throughput cell analysis.\nHeader image adapted from here\n","date":"2024-10-26T00:00:00Z","image":"/p/nanolive-optuna/cells.png","permalink":"/p/nanolive-optuna/","title":"Micro-imaging Segmentation at Nanolive"},{"content":"Analysing game data Who doesn\u0026rsquo;t want to (over)analyse the games they\u0026rsquo;re playing? Well, even if you wanted to most games don\u0026rsquo;t make their data publicly available. This is why, when a surprisingly deep auto battler made their data available, I jumped on the opportunity.\nWhat is PAC PAC is an open-source auto chess game developed by just two fans. It features art from various commisioned artists and units from an extremely recognizable franchise. More than that, it has some of the highest variety of unit interaction I have seen in this genre. A match plays out over multiple rounds. Each round, your team automatically fights one of 7 other opponent\u0026rsquo;s team. The loser loses some HP. Afterwards, both the victor and the loser gain some gold to buy new units before the next round starts.\nThis pattern of team crafting and automated fighting repeats until your HP reaches zero or you\u0026rsquo;re the last player standing. As such the outcome of a game is a ranking between 1 (the winner) and 8 (the first to be eliminated). Your final board state as you win or are eliminated is recorded, including all the units on your board at that time.\nWinrate Analysis Using this data I look at how often a certain unit appears on the final board, and what the outcome for that board was. As there are too many units and variants to get into, for now I\u0026rsquo;m limiting myself to a single category (\u0026ldquo;Uniques\u0026rdquo;). I also filter out units/variants that were played too infrequently (lowest quantile of play rate).\nIn the figure below the x-axis indicates the mean outcome, whereas the y-axis represents the standard deviation of this outcome. This allows us to differentiate between low vs high winrate units as well as the consistency in their placement.\nInteractive Graph The plot below is interactive! Try zooming in\nConclusion As you can see, the most played units are of relatively high winrate and high consistency. This means the playerbase knows what they\u0026rsquo;re doing! There\u0026rsquo;s also a tail of lower consistency lower winrate units. As these analysis go, it\u0026rsquo;s always hard to tell which direction the causality goes: are they less popular because they\u0026rsquo;re less consistent, or are they less consistent because they\u0026rsquo;re not played enough? Either way it\u0026rsquo;s good to see that there are no units that are consistently bad, and only one unit that approaches on the \u0026ldquo;inconsistently\u0026rdquo; good territory. This might be a problematic unit, as it might be an indication that it completely dominates some games but performs subpar in others. And indeed, with the benefit of hindsight, this unit got changed in the next patch.\nPAC is open source made by 2 fans. Play on PAC\n","date":"2024-10-22T00:00:00Z","image":"/p/pac-winrate/pac.png","permalink":"/p/pac-winrate/","title":"PAC Winrate Analysis"}]