VM name variable added

This commit is contained in:
mtorsij
2025-11-26 15:04:01 +01:00
parent 277896394d
commit 8d5e21abff
2 changed files with 25 additions and 12 deletions

View File

@@ -11,7 +11,10 @@ def _():
import ollama import ollama
from ollama import Client from ollama import Client
QUMO_OLLAMA_URL = 'http://ollama-vb.tail44fa00.ts.net:11434' VM_NAME = 'hiperf-gpu'
#VM_NAME = 'ollama-vb'
QUMO_OLLAMA_URL = f'http://{VM_NAME}.tail44fa00.ts.net:11434'
return Client, QUMO_OLLAMA_URL, mo, requests return Client, QUMO_OLLAMA_URL, mo, requests

View File

@@ -7,25 +7,35 @@ app = marimo.App(width="medium")
@app.cell @app.cell
def _(): def _():
import marimo as mo import marimo as mo
return (mo,) import requests
import ollama
from ollama import Client
VM_NAME = 'hiperf-gpu'
#VM_NAME = 'ollama-vb'
QUMO_OLLAMA_URL = f'http://{VM_NAME}.tail44fa00.ts.net:11434'
return Client, QUMO_OLLAMA_URL, VM_NAME, mo, requests
@app.cell @app.cell
def _(): def _(Client, QUMO_OLLAMA_URL, requests):
import ollama try:
from ollama import Client requests.get(QUMO_OLLAMA_URL, timeout=5)
client = Client( client = Client(
host='http://ollama-vb.tail44fa00.ts.net:11434' host=QUMO_OLLAMA_URL
) )
except requests.ConnectionError:
print(f"Failed to reach {QUMO_OLLAMA_URL}. Check that the VM is running and Tailscale is up")
return (client,) return (client,)
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(VM_NAME, mo):
mo.md(r""" mo.md(rf"""
# Ollama Reference # Ollama Reference
## Ollama Web-UI: http://ollama-vb.tail44fa00.ts.net:3000 ## Ollama Web-UI: http://{VM_NAME}.tail44fa00.ts.net:3000
Use the UI to modify system prompts, custom models, etc... Use the UI to modify system prompts, custom models, etc...
**if the connection fails, make sure Tailscale is up** **if the connection fails, make sure Tailscale is up**
@@ -66,7 +76,7 @@ def _(mo):
@app.cell @app.cell
def _(client): def _(client):
response_chat = client.chat(model='deepseek-r1:7b', messages=[ response_chat = client.chat(model='deepseek-r1:32b', messages=[
{ {
'role': 'user', 'role': 'user',
'content': 'Why is the sky blue?', 'content': 'Why is the sky blue?',