Spaces:
Running
Running
Sync from GitHub
Browse files- src/__main__.py +8 -1
- src/interface.py +1 -7
src/__main__.py
CHANGED
|
@@ -35,6 +35,13 @@ if compile_stage := getenv("COMPILE_STAGE", "False").lower() in ("true", "1", "y
|
|
| 35 |
_logger.info(f'COMPILE DIRECTORY SET TO: .{sep}{BUILD_DIR}')
|
| 36 |
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
def main():
|
| 39 |
"""Launch the AI Python C Extensions Generator application."""
|
| 40 |
_logger.info('STARTING AI PYTHON C EXTENSIONS GENERATOR...')
|
|
@@ -47,7 +54,7 @@ def main():
|
|
| 47 |
"test_extension": test_extension,
|
| 48 |
"compile_path": BUILD_DIR})
|
| 49 |
app = get_interface(**interface_config)
|
| 50 |
-
app.launch(footer_links=[])
|
| 51 |
# We return the app instance for potential use in autoreload scenarios.
|
| 52 |
return app
|
| 53 |
|
|
|
|
| 35 |
_logger.info(f'COMPILE DIRECTORY SET TO: .{sep}{BUILD_DIR}')
|
| 36 |
|
| 37 |
|
| 38 |
+
# CSS styles for the interface, defining background colors for C and Python code areas.
|
| 39 |
+
css = """
|
| 40 |
+
.c_ext {background-color: #050;}
|
| 41 |
+
.python {background-color: #306998;}
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
|
| 45 |
def main():
|
| 46 |
"""Launch the AI Python C Extensions Generator application."""
|
| 47 |
_logger.info('STARTING AI PYTHON C EXTENSIONS GENERATOR...')
|
|
|
|
| 54 |
"test_extension": test_extension,
|
| 55 |
"compile_path": BUILD_DIR})
|
| 56 |
app = get_interface(**interface_config)
|
| 57 |
+
app.launch(footer_links=[], css=css)
|
| 58 |
# We return the app instance for potential use in autoreload scenarios.
|
| 59 |
return app
|
| 60 |
|
src/interface.py
CHANGED
|
@@ -5,12 +5,6 @@ from gradio import Textbox
|
|
| 5 |
|
| 6 |
from .examples import example_dict
|
| 7 |
|
| 8 |
-
# CSS styles for the interface, defining background colors for C and Python code areas.
|
| 9 |
-
css = """
|
| 10 |
-
.c_ext {background-color: #050;}
|
| 11 |
-
.python {background-color: #306998;}
|
| 12 |
-
"""
|
| 13 |
-
|
| 14 |
|
| 15 |
def _compile_extension():
|
| 16 |
return "COMPILE_EXTENSION PLACEHOLDER"
|
|
@@ -27,7 +21,7 @@ def get_interface(optimize_function, compile_stage=False,
|
|
| 27 |
compile_path="compiled",
|
| 28 |
models=["gpt-5.1-codex-mini"]):
|
| 29 |
"""Get the Gradio Blocks interface for the AI Python C Extensions Generator."""
|
| 30 |
-
with Blocks(title="AI Python C Extensions Generator"
|
| 31 |
compile_path_st = State(value=compile_path)
|
| 32 |
Markdown("## Convert code from Python to C Extension")
|
| 33 |
|
|
|
|
| 5 |
|
| 6 |
from .examples import example_dict
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def _compile_extension():
|
| 10 |
return "COMPILE_EXTENSION PLACEHOLDER"
|
|
|
|
| 21 |
compile_path="compiled",
|
| 22 |
models=["gpt-5.1-codex-mini"]):
|
| 23 |
"""Get the Gradio Blocks interface for the AI Python C Extensions Generator."""
|
| 24 |
+
with Blocks(title="AI Python C Extensions Generator") as ui:
|
| 25 |
compile_path_st = State(value=compile_path)
|
| 26 |
Markdown("## Convert code from Python to C Extension")
|
| 27 |
|