Spaces:
Sleeping
Sleeping
Sync from GitHub
Browse files55 unmodified lines565758596061626364656667686970717273747576777879808182838422 unmodified lines10710810911011111213 unmodified lines12612712812913013113213313413513613713813914014114214313 unmodified lines15715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319412 unmodified lines2072082092102112122134 unmodified lines21821922055 unmodified linesThe app reads configuration from environment variables and from a `.env` file if present.* `MODELS`: Colon-separated list of models to expose in the dropdown.\Example:```bashexport MODELS="gpt-5.1-codex-mini:gpt-5.4-mini"``````powershell$env:MODELS = "gpt-5.1-codex-mini:gpt-5.4-mini"```If not set, the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.* `COMPILE_STAGE`: Set to `true`, `1`, or `yes` to enable the compile and test stage.\Example:```bashexport COMPILE_STAGE=true``````powershell$env:COMPILE_STAGE = "true"```### Running locally22 unmodified lines* **Dropdown selectors and input fields**:* **Module name input**:A text input field where users can specify the name of the C extension module to begenerated.13 unmodified lines```* **Model selector**:A dropdown menu to select the model used for code generation.The available options are taken from the `MODELS` environment variable if set.Otherwise the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.* **Platform selector**:A dropdown menu to select the target platform for the generated C extension.This affects how the app frames the prompt for the model and ensures thegenerated code targets the selected platform (`Windows` or `Linux`).* **Examples selector**:A list of ready-made Python examples to load into the input field.Built-in examples include `Hello world`, `Sum array`, `Fibonacci`, `Leibniz pi`,13 unmodified lines> optimized must contain only declarations such as DEF or CLASS.* **C extension code**:A text area that displays the generated C extension code.* **Compilation code**:A text area that shows the generated `setup.py` code.This file is required to compile the C extension.* **Test compare code**:A text area that provides example code to run the compiled C extension.* **Output areas**:These are non-editable areas that display the results of various operations.* **C Extension result**:A text area that displays the output of the C extension code build.Beware that this area can contain a large amount of text including warnings duringthe compilation process and sensible information about the local environment,like: paths, Python version, etc may be included.Redact that information if you plan to share the output.* **Test result**:A text area that displays the output of the test code run.* **Buttons**:* **Generate extension code**:A button that triggers the generation of the C extension code from the providedPython code.It will call the model to generate the C code, the setup.py file and the test code,filling the corresponding text areas automatically.* **Compile extension**:A button that compiles the generated C extension using the provided `setup.py` file.It will create the extension C file, `<module_name>.c`, and the `setup.py` file inthe local folder, then it will run the compilation command and build the C extension,12 unmodified linesIt will display the compilation output in the "C Extension result" area.* **Test code**:A button that executes the test code to compare the performance of the originalPython code and the generated C extension.4 unmodified linesWill save the test code provided in the "Test compare code" into the`usage_example.py` file and execute it, showing the output in the "Test result" area.55 unmodified lines56575859606162636465666768697071727374757677787980818283848586878889909192939422 unmodified lines11711811912012112212313 unmodified lines13713813914014114214314414514614714814915015115215315415515615713 unmodified lines17117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721812 unmodified lines2312322332342352362372384 unmodified lines24324424524624724824955 unmodified linesThe app reads configuration from environment variables and from a `.env` file if present.* `MODELS`: Colon-separated list of models to expose in the dropdown.* Examples:*bash:*```bashexport MODELS="gpt-5.1-codex-mini:gpt-5.4-mini"```*powershell:*```powershell$env:MODELS = "gpt-5.1-codex-mini:gpt-5.4-mini"```If not set, the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.* `COMPILE_STAGE`: Set to `true`, `1`, or `yes` to enable the compile and test stage.* Examples:*bash:*```bashexport COMPILE_STAGE=true```*powershell:*```powershell$env:COMPILE_STAGE = "true"```### Running locally22 unmodified lines* **Dropdown selectors and input fields**:* **Module name input**:A text input field where users can specify the name of the C extension module to begenerated.13 unmodified lines```* **Model selector**:A dropdown menu to select the model used for code generation.The available options are taken from the `MODELS` environment variable if set.Otherwise the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.* **Platform selector**:A dropdown menu to select the target platform for the generated C extension.This affects how the app frames the prompt for the model and ensures thegenerated code targets the selected platform (`Windows` or `Linux`).* **Examples selector**:A list of ready-made Python examples to load into the input field.Built-in examples include `Hello world`, `Sum array`, `Fibonacci`, `Leibniz pi`,13 unmodified lines> optimized must contain only declarations such as DEF or CLASS.* **C extension code**:A text area that displays the generated C extension code.* **Compilation code**:A text area that shows the generated `setup.py` code.This file is required to compile the C extension.* **Test compare code**:A text area that provides example code to run the compiled C extension.* **Output areas**:These are non-editable areas that display the results of various operations.* **C Extension result**: *(Only with Compile Stage Enabled)*A text area that displays the output of the C extension code build.> [!CAUTION]> Beware that this area can contain a large amount of text including warnings during> the compilation process and sensible information about the local environment,> like: paths, Python version, etc may be included.>> Redact that information if you plan to share the output.* **Test result**: *(Only with Compile Stage Enabled)*A text area that displays the output of the test code run.* **Buttons**:* **Generate extension code**:A button that triggers the generation of the C extension code from the providedPython code.It will call the model to generate the C code, the setup.py file and the test code,filling the corresponding text areas automatically.* **Compile extension**: *(Only with Compile Stage Enabled)*A button that compiles the generated C extension using the provided `setup.py` file.It will create the extension C file, `<module_name>.c`, and the `setup.py` file inthe local folder, then it will run the compilation command and build the C extension,12 unmodified linesIt will display the compilation output in the "C Extension result" area.* **Test code**: *(Only with Compile Stage Enabled)*A button that executes the test code to compare the performance of the originalPython code and the generated C extension.4 unmodified linesWill save the test code provided in the "Test compare code" into the`usage_example.py` file and execute it, showing the output in the "Test result" area.## TO DO* Add an Anthropic Claude based `optimizer`
README.md+53-24