Code Monkey home page Code Monkey logo

Comments (5)

colaboratory-team avatar colaboratory-team commented on June 7, 2024 1

Thanks for the feedback, we'll take that into consideration. In the meantime, two options that may work for you:

  1. Forms are a handy way to supply parameters to code, and can be updated programmatically. See a demo notebook here https://colab.research.google.com/notebooks/forms.ipynb
  2. You can insert code into a new scratch cell, which won't be saved to the notebook but can then be executed by the user:
from google.colab import _frontend
_frontend.create_scratch_cell('print("your code here")')

from colabtools.

davies-w avatar davies-w commented on June 7, 2024

Note this is not unrelated to #42 - I'd actually tried %load and found it didn't work either, but it would have only been a half solution to what I want to do. I'm looking at using LLM code generation to read a description from a text box, and then insert the code required in the colab. It's not that dissimilar to the "AI" button, but would be more programmatically controllable.

from colabtools.

davies-w avatar davies-w commented on June 7, 2024

Thanks Colab Team! I'll try the scratch cell approach - that might be enough for now, although I'd love to be able to alternate text and code programmatically!

from colabtools.

davies-w avatar davies-w commented on June 7, 2024

Hi,

Just some feedback here - the create_scratch_cell approach is pretty much what I needed, but it'd be really nice to have it have the option to make it a regular cell, and to have it append to the end of the current cells. Having the user review the code before pasting it in seems redundant from a security point of view, as you still need to manually run the cell (and the code is easier to read in that cell anyway). Or at least have a one time pop up that says "trust code to be pasted into an executable cell" for this colab.

One other "bug" that I've found is that if you approve the popup too soon, the cell hangs, and you can't execute the scratch cell. Maybe that's a feature, I don't know, but it feels like a bug.

from colabtools.

cperry-goog avatar cperry-goog commented on June 7, 2024

One other "bug" that I've found is that if you approve the popup too soon, the cell hangs, and you can't execute the scratch cell. Maybe that's a feature, I don't know, but it feels like a bug.

I can't get this to repro for myself - I use the above snippet, execute, immediately click authorize and the cell adds and executes no problem. Am I doing it wrong?

from colabtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.