Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from scripts.codeforces_sync import run_cf_sync
|
| 3 |
from scripts.leetcode_fetch import run_lc_sync
|
| 4 |
|
| 5 |
def handle_cf():
|
|
|
|
| 6 |
return run_cf_sync()
|
| 7 |
|
| 8 |
def handle_lc(mode):
|
|
|
|
| 9 |
return run_lc_sync(mode)
|
| 10 |
|
| 11 |
with gr.Blocks() as demo:
|
|
@@ -20,7 +28,6 @@ with gr.Blocks() as demo:
|
|
| 20 |
lc_btn = gr.Button("Sync LeetCode")
|
| 21 |
lc_file = gr.File(label="LC Output")
|
| 22 |
|
| 23 |
-
# API Endpoints
|
| 24 |
cf_btn.click(handle_cf, outputs=cf_file, api_name="cf_sync")
|
| 25 |
lc_btn.click(handle_lc, inputs=mode_select, outputs=lc_file, api_name="lc_sync")
|
| 26 |
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# Ensure the app directory is in the path so it can see 'scripts'
|
| 5 |
+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
from scripts.codeforces_sync import run_cf_sync
|
| 9 |
from scripts.leetcode_fetch import run_lc_sync
|
| 10 |
|
| 11 |
def handle_cf():
|
| 12 |
+
# Calling the function from our script
|
| 13 |
return run_cf_sync()
|
| 14 |
|
| 15 |
def handle_lc(mode):
|
| 16 |
+
# Calling the function from our script
|
| 17 |
return run_lc_sync(mode)
|
| 18 |
|
| 19 |
with gr.Blocks() as demo:
|
|
|
|
| 28 |
lc_btn = gr.Button("Sync LeetCode")
|
| 29 |
lc_file = gr.File(label="LC Output")
|
| 30 |
|
|
|
|
| 31 |
cf_btn.click(handle_cf, outputs=cf_file, api_name="cf_sync")
|
| 32 |
lc_btn.click(handle_lc, inputs=mode_select, outputs=lc_file, api_name="lc_sync")
|
| 33 |
|