Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -145,6 +145,14 @@ def download_notebook_from_drive(drive_service, temp_dir):
|
|
| 145 |
st.error(f"Failed to download notebook from Drive: {e}")
|
| 146 |
raise
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
def push_kaggle_kernel(api, temp_dir, notebook_slug):
|
| 149 |
try:
|
| 150 |
drive_service = setup_drive_service()
|
|
@@ -225,7 +233,7 @@ def process_video(api, drive_service, video_file):
|
|
| 225 |
|
| 226 |
while time.time() - start_time < overall_timeout:
|
| 227 |
try:
|
| 228 |
-
status_response = api
|
| 229 |
current_status = status_response.status if hasattr(status_response, 'status') else 'unknown'
|
| 230 |
|
| 231 |
if current_status in ['queued', 'running']:
|
|
|
|
| 145 |
st.error(f"Failed to download notebook from Drive: {e}")
|
| 146 |
raise
|
| 147 |
|
| 148 |
+
def check_kernel_status(api, notebook_slug):
|
| 149 |
+
try:
|
| 150 |
+
status_response = api.kernel_status(notebook_slug)
|
| 151 |
+
return status_response
|
| 152 |
+
except Exception as e:
|
| 153 |
+
st.error(f"Error checking kernel status: {e}")
|
| 154 |
+
return None
|
| 155 |
+
|
| 156 |
def push_kaggle_kernel(api, temp_dir, notebook_slug):
|
| 157 |
try:
|
| 158 |
drive_service = setup_drive_service()
|
|
|
|
| 233 |
|
| 234 |
while time.time() - start_time < overall_timeout:
|
| 235 |
try:
|
| 236 |
+
status_response = check_kernel_status(api, notebook_slug)
|
| 237 |
current_status = status_response.status if hasattr(status_response, 'status') else 'unknown'
|
| 238 |
|
| 239 |
if current_status in ['queued', 'running']:
|