Initial commit: Advanced Code Interpreter Sandbox
Browse files- .gitignore +7 -0
- app.py +31 -13
.gitignore
CHANGED
|
@@ -137,3 +137,10 @@ Thumbs.db
|
|
| 137 |
|
| 138 |
# Gradio
|
| 139 |
gradio_cached_examples/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
# Gradio
|
| 139 |
gradio_cached_examples/
|
| 140 |
+
|
| 141 |
+
# Debug and deployment scripts
|
| 142 |
+
deploy.py
|
| 143 |
+
check_space.py
|
| 144 |
+
get_build_logs.py
|
| 145 |
+
monitor_build.py
|
| 146 |
+
build_log.txt
|
app.py
CHANGED
|
@@ -348,12 +348,7 @@ def create_interface():
|
|
| 348 |
file_count="single"
|
| 349 |
)
|
| 350 |
upload_btn = gr.Button("π€ Upload")
|
| 351 |
-
|
| 352 |
-
upload_btn.click(
|
| 353 |
-
fn=upload_file,
|
| 354 |
-
inputs=file_upload,
|
| 355 |
-
outputs=gr.Textbox(label="Status")
|
| 356 |
-
)
|
| 357 |
|
| 358 |
with gr.Column():
|
| 359 |
gr.Markdown("### File Operations")
|
|
@@ -361,16 +356,34 @@ def create_interface():
|
|
| 361 |
refresh_btn = gr.Button("π Refresh File List")
|
| 362 |
files_display = gr.Textbox(label="Files", lines=10, interactive=False)
|
| 363 |
|
| 364 |
-
refresh_btn.click(
|
| 365 |
-
fn=list_files,
|
| 366 |
-
outputs=files_display
|
| 367 |
-
)
|
| 368 |
-
|
| 369 |
file_selector = gr.Dropdown(
|
| 370 |
label="Select File",
|
| 371 |
-
choices=
|
|
|
|
| 372 |
)
|
| 373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
with gr.Row():
|
| 375 |
read_btn = gr.Button("π Read File")
|
| 376 |
del_btn = gr.Button("ποΈ Delete File")
|
|
@@ -383,10 +396,15 @@ def create_interface():
|
|
| 383 |
outputs=file_content
|
| 384 |
)
|
| 385 |
|
|
|
|
|
|
|
| 386 |
del_btn.click(
|
| 387 |
fn=delete_file,
|
| 388 |
inputs=file_selector,
|
| 389 |
-
outputs=
|
|
|
|
|
|
|
|
|
|
| 390 |
)
|
| 391 |
|
| 392 |
with gr.Tab("π¦ Package Manager"):
|
|
|
|
| 348 |
file_count="single"
|
| 349 |
)
|
| 350 |
upload_btn = gr.Button("π€ Upload")
|
| 351 |
+
upload_status = gr.Textbox(label="Status", lines=5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
|
| 353 |
with gr.Column():
|
| 354 |
gr.Markdown("### File Operations")
|
|
|
|
| 356 |
refresh_btn = gr.Button("π Refresh File List")
|
| 357 |
files_display = gr.Textbox(label="Files", lines=10, interactive=False)
|
| 358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
file_selector = gr.Dropdown(
|
| 360 |
label="Select File",
|
| 361 |
+
choices=[],
|
| 362 |
+
value=None
|
| 363 |
)
|
| 364 |
|
| 365 |
+
# Define refresh function
|
| 366 |
+
def refresh_and_update():
|
| 367 |
+
file_list = list_files()
|
| 368 |
+
choices = list(session_state["files"].keys())
|
| 369 |
+
return file_list, gr.update(choices=choices)
|
| 370 |
+
|
| 371 |
+
# Update refresh button
|
| 372 |
+
refresh_btn.click(
|
| 373 |
+
fn=refresh_and_update,
|
| 374 |
+
outputs=[files_display, file_selector]
|
| 375 |
+
)
|
| 376 |
+
|
| 377 |
+
# Update upload button
|
| 378 |
+
upload_btn.click(
|
| 379 |
+
fn=upload_file,
|
| 380 |
+
inputs=file_upload,
|
| 381 |
+
outputs=upload_status
|
| 382 |
+
).then(
|
| 383 |
+
fn=refresh_and_update,
|
| 384 |
+
outputs=[files_display, file_selector]
|
| 385 |
+
)
|
| 386 |
+
|
| 387 |
with gr.Row():
|
| 388 |
read_btn = gr.Button("π Read File")
|
| 389 |
del_btn = gr.Button("ποΈ Delete File")
|
|
|
|
| 396 |
outputs=file_content
|
| 397 |
)
|
| 398 |
|
| 399 |
+
del_status = gr.Textbox(label="Status", lines=5)
|
| 400 |
+
|
| 401 |
del_btn.click(
|
| 402 |
fn=delete_file,
|
| 403 |
inputs=file_selector,
|
| 404 |
+
outputs=del_status
|
| 405 |
+
).then(
|
| 406 |
+
fn=refresh_and_update,
|
| 407 |
+
outputs=[files_display, file_selector]
|
| 408 |
)
|
| 409 |
|
| 410 |
with gr.Tab("π¦ Package Manager"):
|