import subprocess from pathlib import Path import gradio as gr FREEZE_FILE = "requirements_full.txt" def dump_installed_packages(): """Generate the list of installed packages into a file.""" try: with open(FREEZE_FILE, "w") as f: subprocess.run(["pip", "freeze"], stdout=f, check=True) except Exception as e: print(f"[ERROR] Could not write requirements: {e}") # Generate it once at runtime dump_installed_packages() with gr.Blocks() as demo: gr.Markdown("📦 Download the list of installed Python packages:") gr.File(value=FREEZE_FILE, label="requirements_full.txt") # IMPORTANT: This is required in Hugging Face Spaces using Docker if __name__ == "__main__": demo.launch(server_name="0.0.0.0", server_port=7860, #mcp_server=True ) # import gradio as gr # import json # from utils.main_processor import get_statistics # # Interface # with gr.Blocks() as ui: # with gr.Row(): # file_input = gr.File(file_types=[".geojson"]) # with gr.Row(): # with gr.Column(): # submit_btn = gr.Button("Submit") # with gr.Row(): # output = gr.Dataframe() # # Submit button action # submit_btn.click(get_statistics, # file_input, output) # # Launch app # if __name__ == "__main__": # ui.launch( # server_name="0.0.0.0", # server_port=7860, # #mcp_server=True, # show_error=True # )