Upload 3 files
Browse files- Dockerfile +12 -0
- app.py +34 -0
- style.css +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
COPY . /app
|
| 7 |
+
|
| 8 |
+
RUN pip install --no-cache-dir gradio
|
| 9 |
+
|
| 10 |
+
EXPOSE 7860
|
| 11 |
+
|
| 12 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import os
|
| 3 |
+
import time
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
|
| 8 |
+
BASE_DIR = Path(__file__).resolve().parent
|
| 9 |
+
|
| 10 |
+
def load_css() -> str:
|
| 11 |
+
css_path = BASE_DIR / "style.css"
|
| 12 |
+
if css_path.exists():
|
| 13 |
+
return css_path.read_text(encoding="utf-8")
|
| 14 |
+
return ""
|
| 15 |
+
|
| 16 |
+
def run_dummy():
|
| 17 |
+
return "Pipeline executed successfully at " + time.strftime("%H:%M:%S")
|
| 18 |
+
|
| 19 |
+
css_text = load_css()
|
| 20 |
+
|
| 21 |
+
with gr.Blocks(title="RX12 Workshop App", css=css_text) as demo:
|
| 22 |
+
|
| 23 |
+
gr.Markdown(
|
| 24 |
+
"# RX12 - Intro to Python and R - Workshop App
|
| 25 |
+
"
|
| 26 |
+
"*Docker Version – CSS injected via Blocks(css=...)*"
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
with gr.Tab("Pipeline Runner"):
|
| 30 |
+
btn = gr.Button("Run Pipeline", variant="primary")
|
| 31 |
+
log = gr.Textbox(label="Execution Log", lines=10)
|
| 32 |
+
btn.click(run_dummy, outputs=log)
|
| 33 |
+
|
| 34 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|
style.css
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
body {
|
| 3 |
+
background: linear-gradient(135deg, #1e3c72, #2a5298);
|
| 4 |
+
min-height: 100vh !important;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
.gradio-container {
|
| 8 |
+
background: rgba(255, 255, 255, 0.92) !important;
|
| 9 |
+
border-radius: 16px !important;
|
| 10 |
+
padding: 40px !important;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
h1, h2, h3 {
|
| 14 |
+
font-weight: 700 !important;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
button.primary {
|
| 18 |
+
background-color: #111 !important;
|
| 19 |
+
color: #fff !important;
|
| 20 |
+
border-radius: 12px !important;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
button.primary:hover {
|
| 24 |
+
background-color: #333 !important;
|
| 25 |
+
}
|