{"id":12662,"date":"2025-07-10T15:10:19","date_gmt":"2025-07-10T14:10:19","guid":{"rendered":"https:\/\/www.blopig.com\/blog\/?p=12662"},"modified":"2025-07-17T12:46:20","modified_gmt":"2025-07-17T11:46:20","slug":"gui-slop","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2025\/07\/gui-slop\/","title":{"rendered":"GUI Slop"},"content":{"rendered":"\n<p>Previously, I wrote about writing GUI&#8217;s for controlling and monitoring experiments. For ML this might be useful for tracking model learning (e.g. the popular weights and biases platform), while in the wet-lab it is great for making experiments simpler and more reliable to run, monitor and record. <\/p>\n\n\n\n<p>And as it turns out, AI is quite good at this!<\/p>\n\n\n\n<p>I have been using VSCode CoPilot in agent mode with Gemini 2.5 Pro to create simple GUIs that can control my experiments, which has proved pretty effective. Although there is clearly a concern when interfacing AI generated code with real hardware (especially if you &#8220;vibe code&#8221;, that is, just run whatever it generates) in practice it has allowed me to quickly generate tools for testing purposes, cutting the time required for getting a project started from hours to minutes. <\/p>\n\n\n\n<p>As an example, I recently needed to hook up a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Helmholtz_coil\">Helmholtz coil<\/a> to some custom electronics, centred around a Teensy micro-controller and designed to output a precisely controlled current.<\/p>\n\n\n\n<div class=\"wp-block-jetpack-tiled-gallery aligncenter is-style-rectangular\"><div class=\"\"><div class=\"tiled-gallery__gallery\"><div class=\"tiled-gallery__row\"><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?strip=info&#038;w=600&#038;ssl=1 600w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?strip=info&#038;w=900&#038;ssl=1 900w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?strip=info&#038;w=1200&#038;ssl=1 1200w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?strip=info&#038;w=1500&#038;ssl=1 1500w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?strip=info&#038;w=1536&#038;ssl=1 1536w\" alt=\"\" data-height=\"2048\" data-id=\"12768\" data-link=\"https:\/\/www.blopig.com\/blog\/?attachment_id=12768\" data-url=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg\" data-width=\"1536\" src=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5642-768x1024.jpeg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><div class=\"tiled-gallery__col\" style=\"flex-basis:50.00000%\"><figure class=\"tiled-gallery__item\"><img decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?strip=info&#038;w=600&#038;ssl=1 600w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?strip=info&#038;w=900&#038;ssl=1 900w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?strip=info&#038;w=1200&#038;ssl=1 1200w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?strip=info&#038;w=1500&#038;ssl=1 1500w,https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?strip=info&#038;w=1536&#038;ssl=1 1536w\" alt=\"\" data-height=\"2048\" data-id=\"12771\" data-link=\"https:\/\/www.blopig.com\/blog\/?attachment_id=12771\" data-url=\"https:\/\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg\" data-width=\"1536\" src=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/IMG_5641-768x1024.jpeg?ssl=1\" data-amp-layout=\"responsive\"\/><\/figure><\/div><\/div><\/div><\/div><\/div>\n\n\n\n<!--more-->\n\n\n\n<p>The Teensy code was already developed, and I already had a python library for talking to the device (basically a wrapper around a bunch of serial commands), but using it involved writing new python scripts each time I wanted something changed &#8211; not ideal for quick testing on the bench.<\/p>\n\n\n\n<p>First, I asked CoPilot to create a terminal user interface (TUI), thinking this might be a simpler task &#8211; in this proved very difficult! The model struggled to generate an interface, perhaps because of the obscurity of the TUI library or perhaps because it is simply difficult to build an interface in the terminal which updates information live (the magnet sensor readings) while also allowing user input (note it is certainly <em>possible<\/em>, see any number of utils &#8211; my most commonly used being htop). <\/p>\n\n\n\n<p>As a second attempt, I asked CoPilot to write a GUI using NiceGUI &#8211; an easy to use python library for writing simple web apps. As guidance, I also told the model to use a queue to communicate with the electronics, since the serial interface means commands should be sent one at a time and in an orderly fashion.<\/p>\n\n\n\n<p><strong>Prompt: <\/strong>Wrie a simple web gui using the python library nicegui that (a) displays the hall sensor reading, updating every 0.1 seconds, and (b) allows for setting the current in amps using a text input and a button. Create a new file for this GUI. Remember that the syncboard<sup data-fn=\"c3860d63-3874-4849-b744-25da66376681\" class=\"fn\"><a href=\"#c3860d63-3874-4849-b744-25da66376681\" id=\"c3860d63-3874-4849-b744-25da66376681-link\">1<\/a><\/sup> can only handle one message at a time, so use a queue to communicate with it.<\/p>\n\n\n\n<p>It <em>almost <\/em>worked! A few rounds of pasting error messages into the chat and letting the model do it&#8217;s thing led and the app was running, though not quite working. <\/p>\n\n\n\n<p><strong>Prompt: <\/strong>The syncboard is not changing the magnet current when it is set. I expect this is because the hall readings are getting in the way of sending the write magnet current command<\/p>\n\n\n\n<p>Following this prompt, everything suddenly worked. In 10 minutes, I had a GUI implementing a pretty reasonable priority queue based structure that certainly served the purpose of testing the hardware. Even better, as I needed new features I simply asked for them (e.g. a shutdown button) and because the underlying structure was already decent, these were implemented correctly first time by the model. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-26-135512.png?ssl=1\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"625\" height=\"466\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-26-135512.png?resize=625%2C466&#038;ssl=1\" alt=\"\" class=\"wp-image-12769\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-26-135512.png?w=741&amp;ssl=1 741w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-26-135512.png?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2025\/06\/Screenshot-2025-06-26-135512.png?resize=624%2C465&amp;ssl=1 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/figure>\n\n\n\n<p>In summary, using the agent to speed up tools development has proved very effective. Given some guidance, and using libraries that can already handle the hard tasks (e.g. rendering a GUI), the model generates perfectly good code with which to quickly get started testing some hardware. I could imagine it proving just as good (or even better) at creating a GUI interface to a software tool. It is not necessarily great at reasoning about how everything works, but it allows <em>you <\/em>to focus more on the high level, communicating your thoughts with it, while handles the nitty gritty of actually implementing said ideas.<\/p>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"c3860d63-3874-4849-b744-25da66376681\">this is how the electronics board is referred to in the code <a href=\"#c3860d63-3874-4849-b744-25da66376681-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>Previously, I wrote about writing GUI&#8217;s for controlling and monitoring experiments. For ML this might be useful for tracking model learning (e.g. the popular weights and biases platform), while in the wet-lab it is great for making experiments simpler and more reliable to run, monitor and record. And as it turns out, AI is quite [&hellip;]<\/p>\n","protected":false},"author":122,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"[{\"id\":\"c3860d63-3874-4849-b744-25da66376681\",\"content\":\"this is how the electronics board is referred to in the code\"}]"},"categories":[633,29],"tags":[860,862,861],"ppma_author":[757],"class_list":["post-12662","post","type-post","status-publish","format-standard","hentry","category-ai","category-code","tag-copilot","tag-gui","tag-nicegui"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":757,"user_id":122,"is_guest":0,"slug":"gabrahams","display_name":"Gabriel Abrahams","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/29ab3dc0cb027e68f82da6960bc00599c7730dd2855c1553dc2872b00cf6c558?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/12662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/122"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=12662"}],"version-history":[{"count":4,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/12662\/revisions"}],"predecessor-version":[{"id":12790,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/12662\/revisions\/12790"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=12662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=12662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=12662"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=12662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}