Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- Dockerfile +13 -9
- README.md +1 -0
- demo.launcher +11 -2
Dockerfile
CHANGED
@@ -1,26 +1,30 @@
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
-
# System
|
4 |
RUN apt-get update && apt-get install -y curl sqlite3 python3 python3-pip
|
5 |
|
6 |
# Install Ollama
|
7 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
8 |
|
9 |
-
# Copy
|
10 |
COPY requirements.txt .
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
# Copy
|
14 |
-
COPY
|
15 |
|
16 |
-
#
|
17 |
-
RUN
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
|
|
|
22 |
USER user
|
23 |
|
24 |
-
#
|
|
|
|
|
|
|
25 |
CMD ["./demo.launcher"]
|
26 |
|
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
+
# System dependencies
|
4 |
RUN apt-get update && apt-get install -y curl sqlite3 python3 python3-pip
|
5 |
|
6 |
# Install Ollama
|
7 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
8 |
|
9 |
+
# Copy the requirements file and install Python dependencies
|
10 |
COPY requirements.txt .
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
+
# Copy project files into the container
|
14 |
+
COPY . ./
|
15 |
|
16 |
+
# Make sure the demo.launcher script is executable
|
17 |
+
RUN chmod +x demo.launcher
|
18 |
|
19 |
+
# Add a non-root user and change ownership of necessary files
|
20 |
+
RUN useradd -ms /bin/bash user && chown -R user:user ./server.py ./client.py ./demo.launcher ./requirements.txt ./demo.db
|
21 |
|
22 |
+
# Switch to the non-root user
|
23 |
USER user
|
24 |
|
25 |
+
# Expose the port that Gradio will use
|
26 |
+
EXPOSE 7860
|
27 |
+
|
28 |
+
# Start the demo.launcher script to run everything
|
29 |
CMD ["./demo.launcher"]
|
30 |
|
README.md
CHANGED
@@ -9,6 +9,7 @@ pinned: false
|
|
9 |
tags:
|
10 |
- mcp-server-track
|
11 |
---
|
|
|
12 |
# Ollama MCP Gradio Demo
|
13 |
|
14 |
This Space runs a SQLite MCP server and Gradio client with Ollama and MCP tools, for the Gradio Agents & MCP Hackathon 2025.
|
|
|
9 |
tags:
|
10 |
- mcp-server-track
|
11 |
---
|
12 |
+
|
13 |
# Ollama MCP Gradio Demo
|
14 |
|
15 |
This Space runs a SQLite MCP server and Gradio client with Ollama and MCP tools, for the Gradio Agents & MCP Hackathon 2025.
|
demo.launcher
CHANGED
@@ -1,12 +1,21 @@
|
|
1 |
#!/bin/bash
|
2 |
-
|
|
|
|
|
3 |
ollama pull granite3.1-moe
|
|
|
|
|
|
|
4 |
ollama serve &
|
5 |
-
|
|
|
|
|
6 |
|
7 |
# Start MCP server in the background
|
|
|
8 |
python3 server.py &
|
9 |
|
10 |
# Start Gradio (client.py) on 0.0.0.0:7860
|
|
|
11 |
python3 client.py --server_name 0.0.0.0 --server_port 7860
|
12 |
|
|
|
1 |
#!/bin/bash
|
2 |
+
|
3 |
+
# Ensure that Ollama model is pulled
|
4 |
+
echo "Pulling Ollama model (granite3.1-moe)..."
|
5 |
ollama pull granite3.1-moe
|
6 |
+
|
7 |
+
# Start the Ollama API server in the background
|
8 |
+
echo "Starting Ollama API server..."
|
9 |
ollama serve &
|
10 |
+
|
11 |
+
# Wait for Ollama server to be ready (increase the sleep time if needed)
|
12 |
+
sleep 10
|
13 |
|
14 |
# Start MCP server in the background
|
15 |
+
echo "Starting MCP server..."
|
16 |
python3 server.py &
|
17 |
|
18 |
# Start Gradio (client.py) on 0.0.0.0:7860
|
19 |
+
echo "Starting Gradio client..."
|
20 |
python3 client.py --server_name 0.0.0.0 --server_port 7860
|
21 |
|