Tsitsi19's picture
Initial deployment of OpenManus with Qwen local
0e45712 verified
Raw
History Blame Contribute Delete
1.72 kB
FROM python:3.12-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
build-essential \
libopenblas-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Install llama-cpp-python with OpenBLAS
RUN pip install llama-cpp-python[server] streamlit
# Clone OpenManus
RUN git clone https://github.com/FoundationAgents/OpenManus.git .
# Install OpenManus dependencies
RUN pip install -r requirements.txt
RUN pip install playwright && playwright install --with-deps chromium
# Download Qwen2.5-Coder-7B-Instruct GGUF Q4_K_M
RUN mkdir -p /app/models
RUN curl -L -o /app/models/qwen2.5-coder-7b-instruct-q4_k_m.gguf https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf
# Copy our custom GUI
COPY app_gui.py /app/app_gui.py
# Create config directory and config.toml
RUN mkdir -p /app/config
RUN echo '[llm]\n\
model = "qwen2.5-coder"\n\
base_url = "http://localhost:8001/v1"\n\
api_key = "not-needed"\n\
max_tokens = 4096\n\
temperature = 0.0\n\
' > /app/config/config.toml
# Create a startup script
RUN echo '#!/bin/bash\n\
# Start llama-cpp-python server in background\n\
python3 -m llama_cpp.server --model /app/models/qwen2.5-coder-7b-instruct-q4_k_m.gguf --host 0.0.0.0 --port 8001 &\n\
\n\
# Wait for server to start\n\
until curl -s http://localhost:8001/v1/models > /dev/null; do\n\
echo "Waiting for LLM server..."\n\
sleep 5\n\
done\n\
\n\
# Start Streamlit UI on port 7860\n\
streamlit run app_gui.py --server.port 7860 --server.address 0.0.0.0\n\
' > /app/start.sh && chmod +x /app/start.sh
# HF Spaces expect a web service on port 7860
EXPOSE 7860
CMD ["/app/start.sh"]