Update app.py
Browse files
app.py
CHANGED
|
@@ -75,11 +75,7 @@ def install_system_packages(packages_content, progress=gr.Progress()):
|
|
| 75 |
if line.strip() and not line.strip().startswith('#')]
|
| 76 |
|
| 77 |
if packages_list:
|
| 78 |
-
return f"
|
| 79 |
-
{', '.join(packages_list)}
|
| 80 |
-
|
| 81 |
-
ℹ️ HF Spaces runs in a containerized environment without sudo access.
|
| 82 |
-
These packages need to be pre-installed in the Docker image or available as Python packages."""
|
| 83 |
return "No system packages specified."
|
| 84 |
|
| 85 |
def find_compiled_binary(output_dir, output_filename):
|
|
@@ -304,7 +300,12 @@ def compile_with_nuitka(code, requirements, packages, compilation_mode, output_e
|
|
| 304 |
# Current Python version info
|
| 305 |
current_python = get_current_python_version()
|
| 306 |
|
| 307 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
result_summary = f"""# ✅ Compilation Successful!
|
| 309 |
|
| 310 |
## Compilation Details:
|
|
@@ -312,9 +313,9 @@ def compile_with_nuitka(code, requirements, packages, compilation_mode, output_e
|
|
| 312 |
- **Nuitka Version**: {nuitka_version}
|
| 313 |
- **Exit Code**: {process.returncode}
|
| 314 |
- **Output Path**: {binary_path}
|
| 315 |
-
- **File Size**: {
|
| 316 |
- **Compiled with Python**: {current_python}
|
| 317 |
-
- **Static Libpython Available**: {
|
| 318 |
- **Linking**: {linking_info}
|
| 319 |
|
| 320 |
## Environment Results:
|
|
@@ -333,5 +334,5 @@ def compile_with_nuitka(code, requirements, packages, compilation_mode, output_e
|
|
| 333 |
|
| 334 |
## 📋 Usage Instructions:
|
| 335 |
```bash
|
| 336 |
-
chmod +x {
|
| 337 |
-
./{
|
|
|
|
| 75 |
if line.strip() and not line.strip().startswith('#')]
|
| 76 |
|
| 77 |
if packages_list:
|
| 78 |
+
return f"❌ System packages cannot be installed in Hugging Face Spaces:\n{', '.join(packages_list)}\n\nℹ️ HF Spaces runs in a containerized environment without sudo access.\nThese packages need to be pre-installed in the Docker image or available as Python packages."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
return "No system packages specified."
|
| 80 |
|
| 81 |
def find_compiled_binary(output_dir, output_filename):
|
|
|
|
| 300 |
# Current Python version info
|
| 301 |
current_python = get_current_python_version()
|
| 302 |
|
| 303 |
+
# Build the result summary string
|
| 304 |
+
static_status = "Yes" if has_static_libpython else "No"
|
| 305 |
+
file_size = os.path.getsize(binary_path) / 1024
|
| 306 |
+
binary_basename = os.path.basename(binary_path)
|
| 307 |
+
|
| 308 |
+
# Create result summary without f-string to avoid syntax issues
|
| 309 |
result_summary = f"""# ✅ Compilation Successful!
|
| 310 |
|
| 311 |
## Compilation Details:
|
|
|
|
| 313 |
- **Nuitka Version**: {nuitka_version}
|
| 314 |
- **Exit Code**: {process.returncode}
|
| 315 |
- **Output Path**: {binary_path}
|
| 316 |
+
- **File Size**: {file_size:.2f} KB
|
| 317 |
- **Compiled with Python**: {current_python}
|
| 318 |
+
- **Static Libpython Available**: {static_status}
|
| 319 |
- **Linking**: {linking_info}
|
| 320 |
|
| 321 |
## Environment Results:
|
|
|
|
| 334 |
|
| 335 |
## 📋 Usage Instructions:
|
| 336 |
```bash
|
| 337 |
+
chmod +x {binary_basename}
|
| 338 |
+
./{binary_basename}
|