Spaces:
Running
Running
Sync from GitHub
Browse files
README.md
CHANGED
|
@@ -56,29 +56,39 @@ its performance against the original Python code.
|
|
| 56 |
|
| 57 |
The app reads configuration from environment variables and from a `.env` file if present.
|
| 58 |
|
| 59 |
-
* `MODELS`: Colon-separated list of models to expose in the dropdown.
|
| 60 |
-
Example:
|
| 61 |
|
| 62 |
-
|
| 63 |
-
export MODELS="gpt-5.1-codex-mini:gpt-5.4-mini"
|
| 64 |
-
```
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
If not set, the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.
|
| 71 |
|
| 72 |
-
* `COMPILE_STAGE`: Set to `true`, `1`, or `yes` to enable the compile and test stage.
|
| 73 |
-
Example:
|
| 74 |
|
| 75 |
-
|
| 76 |
-
export COMPILE_STAGE=true
|
| 77 |
-
```
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
### Running locally
|
| 84 |
|
|
@@ -107,6 +117,7 @@ Sections:
|
|
| 107 |
|
| 108 |
* **Dropdown selectors and input fields**:
|
| 109 |
* **Module name input**:
|
|
|
|
| 110 |
A text input field where users can specify the name of the C extension module to be
|
| 111 |
generated.
|
| 112 |
|
|
@@ -126,18 +137,21 @@ Sections:
|
|
| 126 |
```
|
| 127 |
|
| 128 |
* **Model selector**:
|
|
|
|
| 129 |
A dropdown menu to select the model used for code generation.
|
| 130 |
|
| 131 |
The available options are taken from the `MODELS` environment variable if set.
|
| 132 |
Otherwise the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.
|
| 133 |
|
| 134 |
* **Platform selector**:
|
|
|
|
| 135 |
A dropdown menu to select the target platform for the generated C extension.
|
| 136 |
|
| 137 |
This affects how the app frames the prompt for the model and ensures the
|
| 138 |
generated code targets the selected platform (`Windows` or `Linux`).
|
| 139 |
|
| 140 |
* **Examples selector**:
|
|
|
|
| 141 |
A list of ready-made Python examples to load into the input field.
|
| 142 |
|
| 143 |
Built-in examples include `Hello world`, `Sum array`, `Fibonacci`, `Leibniz pi`,
|
|
@@ -157,38 +171,48 @@ Sections:
|
|
| 157 |
> optimized must contain only declarations such as DEF or CLASS.
|
| 158 |
|
| 159 |
* **C extension code**:
|
|
|
|
| 160 |
A text area that displays the generated C extension code.
|
|
|
|
| 161 |
* **Compilation code**:
|
|
|
|
| 162 |
A text area that shows the generated `setup.py` code.
|
| 163 |
This file is required to compile the C extension.
|
|
|
|
| 164 |
* **Test compare code**:
|
|
|
|
| 165 |
A text area that provides example code to run the compiled C extension.
|
| 166 |
|
| 167 |
* **Output areas**:
|
| 168 |
|
| 169 |
These are non-editable areas that display the results of various operations.
|
| 170 |
|
| 171 |
-
* **C Extension result**:
|
|
|
|
| 172 |
A text area that displays the output of the C extension code build.
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
|
| 179 |
|
| 180 |
-
* **Test result**:
|
| 181 |
A text area that displays the output of the test code run.
|
| 182 |
|
| 183 |
* **Buttons**:
|
| 184 |
* **Generate extension code**:
|
|
|
|
| 185 |
A button that triggers the generation of the C extension code from the provided
|
| 186 |
Python code.
|
| 187 |
|
| 188 |
It will call the model to generate the C code, the setup.py file and the test code,
|
| 189 |
filling the corresponding text areas automatically.
|
| 190 |
|
| 191 |
-
* **Compile extension**:
|
|
|
|
| 192 |
A button that compiles the generated C extension using the provided `setup.py` file.
|
| 193 |
It will create the extension C file, `<module_name>.c`, and the `setup.py` file in
|
| 194 |
the local folder, then it will run the compilation command and build the C extension,
|
|
@@ -207,7 +231,8 @@ Sections:
|
|
| 207 |
|
| 208 |
It will display the compilation output in the "C Extension result" area.
|
| 209 |
|
| 210 |
-
* **Test code**:
|
|
|
|
| 211 |
A button that executes the test code to compare the performance of the original
|
| 212 |
Python code and the generated C extension.
|
| 213 |
|
|
@@ -218,3 +243,7 @@ Sections:
|
|
| 218 |
|
| 219 |
Will save the test code provided in the "Test compare code" into the
|
| 220 |
`usage_example.py` file and execute it, showing the output in the "Test result" area.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
The app reads configuration from environment variables and from a `.env` file if present.
|
| 58 |
|
| 59 |
+
* `MODELS`: Colon-separated list of models to expose in the dropdown.
|
|
|
|
| 60 |
|
| 61 |
+
* Examples:
|
|
|
|
|
|
|
| 62 |
|
| 63 |
+
*bash:*
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
export MODELS="gpt-5.1-codex-mini:gpt-5.4-mini"
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
*powershell:*
|
| 70 |
+
|
| 71 |
+
```powershell
|
| 72 |
+
$env:MODELS = "gpt-5.1-codex-mini:gpt-5.4-mini"
|
| 73 |
+
```
|
| 74 |
|
| 75 |
If not set, the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.
|
| 76 |
|
| 77 |
+
* `COMPILE_STAGE`: Set to `true`, `1`, or `yes` to enable the compile and test stage.
|
|
|
|
| 78 |
|
| 79 |
+
* Examples:
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
*bash:*
|
| 82 |
+
|
| 83 |
+
```bash
|
| 84 |
+
export COMPILE_STAGE=true
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
*powershell:*
|
| 88 |
+
|
| 89 |
+
```powershell
|
| 90 |
+
$env:COMPILE_STAGE = "true"
|
| 91 |
+
```
|
| 92 |
|
| 93 |
### Running locally
|
| 94 |
|
|
|
|
| 117 |
|
| 118 |
* **Dropdown selectors and input fields**:
|
| 119 |
* **Module name input**:
|
| 120 |
+
|
| 121 |
A text input field where users can specify the name of the C extension module to be
|
| 122 |
generated.
|
| 123 |
|
|
|
|
| 137 |
```
|
| 138 |
|
| 139 |
* **Model selector**:
|
| 140 |
+
|
| 141 |
A dropdown menu to select the model used for code generation.
|
| 142 |
|
| 143 |
The available options are taken from the `MODELS` environment variable if set.
|
| 144 |
Otherwise the app defaults to `gpt-5.1-codex-mini` and `gpt-5.4-mini`.
|
| 145 |
|
| 146 |
* **Platform selector**:
|
| 147 |
+
|
| 148 |
A dropdown menu to select the target platform for the generated C extension.
|
| 149 |
|
| 150 |
This affects how the app frames the prompt for the model and ensures the
|
| 151 |
generated code targets the selected platform (`Windows` or `Linux`).
|
| 152 |
|
| 153 |
* **Examples selector**:
|
| 154 |
+
|
| 155 |
A list of ready-made Python examples to load into the input field.
|
| 156 |
|
| 157 |
Built-in examples include `Hello world`, `Sum array`, `Fibonacci`, `Leibniz pi`,
|
|
|
|
| 171 |
> optimized must contain only declarations such as DEF or CLASS.
|
| 172 |
|
| 173 |
* **C extension code**:
|
| 174 |
+
|
| 175 |
A text area that displays the generated C extension code.
|
| 176 |
+
|
| 177 |
* **Compilation code**:
|
| 178 |
+
|
| 179 |
A text area that shows the generated `setup.py` code.
|
| 180 |
This file is required to compile the C extension.
|
| 181 |
+
|
| 182 |
* **Test compare code**:
|
| 183 |
+
|
| 184 |
A text area that provides example code to run the compiled C extension.
|
| 185 |
|
| 186 |
* **Output areas**:
|
| 187 |
|
| 188 |
These are non-editable areas that display the results of various operations.
|
| 189 |
|
| 190 |
+
* **C Extension result**: *(Only with Compile Stage Enabled)*
|
| 191 |
+
|
| 192 |
A text area that displays the output of the C extension code build.
|
| 193 |
|
| 194 |
+
> [!CAUTION]
|
| 195 |
+
> Beware that this area can contain a large amount of text including warnings during
|
| 196 |
+
> the compilation process and sensible information about the local environment,
|
| 197 |
+
> like: paths, Python version, etc may be included.
|
| 198 |
+
>
|
| 199 |
+
> Redact that information if you plan to share the output.
|
| 200 |
|
| 201 |
+
* **Test result**: *(Only with Compile Stage Enabled)*
|
| 202 |
|
|
|
|
| 203 |
A text area that displays the output of the test code run.
|
| 204 |
|
| 205 |
* **Buttons**:
|
| 206 |
* **Generate extension code**:
|
| 207 |
+
|
| 208 |
A button that triggers the generation of the C extension code from the provided
|
| 209 |
Python code.
|
| 210 |
|
| 211 |
It will call the model to generate the C code, the setup.py file and the test code,
|
| 212 |
filling the corresponding text areas automatically.
|
| 213 |
|
| 214 |
+
* **Compile extension**: *(Only with Compile Stage Enabled)*
|
| 215 |
+
|
| 216 |
A button that compiles the generated C extension using the provided `setup.py` file.
|
| 217 |
It will create the extension C file, `<module_name>.c`, and the `setup.py` file in
|
| 218 |
the local folder, then it will run the compilation command and build the C extension,
|
|
|
|
| 231 |
|
| 232 |
It will display the compilation output in the "C Extension result" area.
|
| 233 |
|
| 234 |
+
* **Test code**: *(Only with Compile Stage Enabled)*
|
| 235 |
+
|
| 236 |
A button that executes the test code to compare the performance of the original
|
| 237 |
Python code and the generated C extension.
|
| 238 |
|
|
|
|
| 243 |
|
| 244 |
Will save the test code provided in the "Test compare code" into the
|
| 245 |
`usage_example.py` file and execute it, showing the output in the "Test result" area.
|
| 246 |
+
|
| 247 |
+
## TO DO
|
| 248 |
+
|
| 249 |
+
* Add an Anthropic Claude based `optimizer`
|