Spaces:
Sleeping
Sleeping
PierreJousselin
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import subprocess
|
3 |
+
import sys
|
4 |
+
|
5 |
+
# Define the function to run the entire script
|
6 |
+
def run_entsoe_script():
|
7 |
+
# Run the script as a subprocess
|
8 |
+
result = subprocess.run([sys.executable, 'daily_energy_pipeline.py'], capture_output=True, text=True)
|
9 |
+
|
10 |
+
# Return the script's output or any errors
|
11 |
+
return result.stdout if result.returncode == 0 else result.stderr
|
12 |
+
|
13 |
+
# Define Gradio interface (No inputs since we're running the entire script)
|
14 |
+
interface = gr.Interface(
|
15 |
+
fn=run_entsoe_script,
|
16 |
+
inputs=[], # No inputs needed
|
17 |
+
outputs="text", # Output the script's result as text
|
18 |
+
title="Energy Load Prediction",
|
19 |
+
description="Run the energy load prediction pipeline."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Launch the interface
|
23 |
+
interface.launch()
|