Spaces:
Sleeping
Sleeping
Commit ·
00e243c
1
Parent(s): 6e05841
Fix deployment output and finalize app.py link handling
Browse files
app.py
CHANGED
|
@@ -133,6 +133,20 @@ class SpaceCreatorApp:
|
|
| 133 |
except Exception as e:
|
| 134 |
error_msg = self._create_status_message("error", f"Deployment failed: {str(e)}")
|
| 135 |
return None, error_msg, 2, ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
else:
|
| 137 |
code_content = file_content
|
| 138 |
elif input_text.strip():
|
|
|
|
| 133 |
except Exception as e:
|
| 134 |
error_msg = self._create_status_message("error", f"Deployment failed: {str(e)}")
|
| 135 |
return None, error_msg, 2, ""
|
| 136 |
+
|
| 137 |
+
def _extract_code(self, input_text, input_file):
|
| 138 |
+
"""Extract code from text or file"""
|
| 139 |
+
code_content = ""
|
| 140 |
+
if input_file is not None:
|
| 141 |
+
file_content = read_file_content(input_file)
|
| 142 |
+
if input_file.name.endswith('.ipynb') if hasattr(input_file, 'name') else False:
|
| 143 |
+
with tempfile.NamedTemporaryFile(mode='w', suffix='.ipynb', delete=False, encoding='utf-8') as tmp:
|
| 144 |
+
tmp.write(file_content)
|
| 145 |
+
tmp_path = tmp.name
|
| 146 |
+
try:
|
| 147 |
+
code_content = parse_notebook(tmp_path)
|
| 148 |
+
finally:
|
| 149 |
+
os.unlink(tmp_path)
|
| 150 |
else:
|
| 151 |
code_content = file_content
|
| 152 |
elif input_text.strip():
|