leavoigt commited on
Commit
edb4551
·
verified ·
1 Parent(s): b11b7b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -49
app.py CHANGED
@@ -1,58 +1,31 @@
1
- import subprocess
2
- from pathlib import Path
3
  import gradio as gr
 
 
4
 
5
- FREEZE_FILE = "requirements_full.txt"
6
 
7
- def dump_installed_packages():
8
- """Generate the list of installed packages into a file."""
9
- try:
10
- with open(FREEZE_FILE, "w") as f:
11
- subprocess.run(["pip", "freeze"], stdout=f, check=True)
12
- except Exception as e:
13
- print(f"[ERROR] Could not write requirements: {e}")
14
 
15
- # Generate it once at runtime
16
- dump_installed_packages()
17
 
18
- with gr.Blocks() as demo:
19
- gr.Markdown("📦 Download the list of installed Python packages:")
20
- gr.File(value=FREEZE_FILE, label="requirements_full.txt")
21
 
22
- # IMPORTANT: This is required in Hugging Face Spaces using Docker
23
- if __name__ == "__main__":
24
- demo.launch(server_name="0.0.0.0", server_port=7860,
25
- #mcp_server=True
26
- )
27
-
28
- # import gradio as gr
29
- # import json
30
- # from utils.main_processor import get_statistics
31
-
32
-
33
- # # Interface
34
- # with gr.Blocks() as ui:
35
-
36
- # with gr.Row():
37
- # file_input = gr.File(file_types=[".geojson"])
38
-
39
- # with gr.Row():
40
- # with gr.Column():
41
- # submit_btn = gr.Button("Submit")
42
-
43
- # with gr.Row():
44
- # output = gr.Dataframe()
45
 
46
 
47
- # # Submit button action
48
- # submit_btn.click(get_statistics,
49
- # file_input, output)
50
 
51
- # # Launch app
52
- # if __name__ == "__main__":
53
- # ui.launch(
54
- # server_name="0.0.0.0",
55
- # server_port=7860,
56
- # #mcp_server=True,
57
- # show_error=True
58
- # )
 
 
 
1
  import gradio as gr
2
+ import json
3
+ from utils.main_processor import get_statistics
4
 
 
5
 
6
+ # Interface
7
+ with gr.Blocks() as ui:
 
 
 
 
 
8
 
9
+ with gr.Row():
10
+ file_input = gr.File(file_types=[".geojson"])
11
 
12
+ with gr.Row():
13
+ with gr.Column():
14
+ submit_btn = gr.Button("Submit")
15
 
16
+ with gr.Row():
17
+ output = gr.Dataframe()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
 
20
+ # Submit button action
21
+ submit_btn.click(get_statistics,
22
+ file_input, output)
23
 
24
+ # Launch app
25
+ if __name__ == "__main__":
26
+ ui.launch(
27
+ server_name="0.0.0.0",
28
+ server_port=7860,
29
+ #mcp_server=True,
30
+ show_error=True
31
+ )