Spaces:
Runtime error
Runtime error
FROM python:3.9-slim | |
WORKDIR /app | |
# Install dependencies | |
RUN pip install --no-cache-dir \ | |
jupyter \ | |
notebook \ | |
ipywidgets \ | |
numpy \ | |
pandas \ | |
matplotlib \ | |
seaborn \ | |
scikit-learn \ | |
transformers \ | |
torch \ | |
gradio | |
# Create a non-root user to run Jupyter | |
RUN useradd -m jupyter | |
RUN mkdir -p /app/notebooks && chown -R jupyter:jupyter /app | |
# Switch to non-root user | |
USER jupyter | |
# Copy example notebook | |
COPY --chown=jupyter:jupyter welcome.ipynb /app/notebooks/ | |
# Expose port | |
EXPOSE 7860 | |
# Start Jupyter notebook with mobile-friendly options | |
CMD ["python", "-c", "import gradio as gr; import subprocess; import os; proc = subprocess.Popen(['jupyter', 'notebook', '--ip=0.0.0.0', '--port=8888', '--no-browser', '--NotebookApp.token=', '--NotebookApp.password=', '--NotebookApp.allow_origin=*', '--NotebookApp.disable_check_xsrf=True']); demo = gr.Interface(fn=lambda: None, inputs=[], outputs=[gr.HTML('<div style=\"text-align:center; padding:10px;\"><h2>Mobile-Friendly Jupyter Notebook</h2><p>The notebook interface will appear below:</p></div><iframe src=\"/proxy/8888/tree\" width=\"100%\" height=\"800px\" frameborder=\"0\" style=\"overflow:hidden;\"></iframe>')], title='Jupyter Notebook', css=\".gradio-container {max-width: 100% !important; padding: 0 !important;} .min-h-\[48rem\] {min-height: auto !important;}\"); demo.launch(server_port=7860, share=False)"] |