Spaces:
Sleeping
Sleeping
import gradio as gr | |
import subprocess | |
import sys | |
import os | |
# Function to install requirements | |
def install_requirements(): | |
subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]) | |
# Define the function to run the entire script | |
def run_entsoe_script(): | |
# Ensure dependencies are installed first | |
install_requirements() | |
# Run the script as a subprocess | |
result = subprocess.run([sys.executable, 'daily_energy_pipeline.py'], capture_output=True, text=True) | |
# Return the script's output or any errors | |
return result.stdout if result.returncode == 0 else result.stderr | |
# Define Gradio interface (No inputs since we're running the entire script) | |
interface = gr.Interface( | |
fn=run_entsoe_script, | |
inputs=[], # No inputs needed | |
outputs="text", # Output the script's result as text | |
title="Energy Load Prediction", | |
description="Run the energy load prediction pipeline." | |
) | |
# Launch the interface | |
interface.launch() | |