Commit
·
3ee8645
1
Parent(s):
1d28e28
App update
Browse files- Dockerfile +0 -2
- app.py +14 -4
Dockerfile
CHANGED
|
@@ -12,8 +12,6 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
| 12 |
# Install Ollama
|
| 13 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 14 |
|
| 15 |
-
RUN ollama serve
|
| 16 |
-
|
| 17 |
# Set up a new user named "user" with user ID 1000
|
| 18 |
RUN useradd -m -u 1000 user
|
| 19 |
|
|
|
|
| 12 |
# Install Ollama
|
| 13 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 14 |
|
|
|
|
|
|
|
| 15 |
# Set up a new user named "user" with user ID 1000
|
| 16 |
RUN useradd -m -u 1000 user
|
| 17 |
|
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from ollama import chat, ChatResponse
|
| 3 |
import subprocess
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def interact(message: str, history: list):
|
| 6 |
message_dct = {
|
|
@@ -12,7 +15,7 @@ def interact(message: str, history: list):
|
|
| 12 |
chat_history.append(message_dct)
|
| 13 |
|
| 14 |
response: ChatResponse = chat(
|
| 15 |
-
model=
|
| 16 |
messages=chat_history,
|
| 17 |
stream=True
|
| 18 |
)
|
|
@@ -39,9 +42,16 @@ def interact(message: str, history: list):
|
|
| 39 |
interface = gr.ChatInterface(
|
| 40 |
fn=interact,
|
| 41 |
type="messages",
|
| 42 |
-
title="Deepseek-R1 Chat Interface"
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
if __name__ == "__main__":
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from ollama import chat, ChatResponse
|
| 3 |
import subprocess
|
| 4 |
+
import time
|
| 5 |
+
|
| 6 |
+
model_id = "deepseek-r1:1.5b"
|
| 7 |
|
| 8 |
def interact(message: str, history: list):
|
| 9 |
message_dct = {
|
|
|
|
| 15 |
chat_history.append(message_dct)
|
| 16 |
|
| 17 |
response: ChatResponse = chat(
|
| 18 |
+
model=model_id,
|
| 19 |
messages=chat_history,
|
| 20 |
stream=True
|
| 21 |
)
|
|
|
|
| 42 |
interface = gr.ChatInterface(
|
| 43 |
fn=interact,
|
| 44 |
type="messages",
|
| 45 |
+
title="Deepseek-R1 Chat Interface",
|
| 46 |
+
description="Model: Deepseek R1: 1.5B params"
|
| 47 |
)
|
| 48 |
|
| 49 |
if __name__ == "__main__":
|
| 50 |
+
print("\n\nStarting Ollama...\n\n")
|
| 51 |
+
subprocess.Popen(["ollama", "serve"])
|
| 52 |
+
time.sleep(10)
|
| 53 |
+
print("\n\nOllama started successfully!!\n\n\n\nTesting...\n\n")
|
| 54 |
+
subprocess.run(["ollama", "pull", model_id])
|
| 55 |
+
time.sleep(5)
|
| 56 |
+
print("\n\nDeepseek-R1 started successfully!!\n\n")
|
| 57 |
+
interface.launch(server_name="0.0.0.0", server_port=7860)
|