pjxcharya commited on
Commit
5236d13
·
verified ·
1 Parent(s): e3ee9bf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
12
+ gr.Markdown("# Problem Scraper API")
13
+
14
+ with gr.Row():
15
+ cf_btn = gr.Button("Sync Codeforces")
16
+ cf_file = gr.File(label="CF Output")
17
+
18
+ with gr.Row():
19
+ mode_select = gr.Dropdown(["daily", "sync", "details"], value="daily")
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
+
27
+ demo.launch()