From 8d5e21abffdd52ce677420ace6c17b55f202ce14 Mon Sep 17 00:00:00 2001 From: mtorsij Date: Wed, 26 Nov 2025 15:04:01 +0100 Subject: [PATCH] VM name variable added --- Sentiment_Analysis_Research.py | 5 ++++- VB_interviews_sandbox.py | 32 +++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Sentiment_Analysis_Research.py b/Sentiment_Analysis_Research.py index 79a33a1..116635e 100644 --- a/Sentiment_Analysis_Research.py +++ b/Sentiment_Analysis_Research.py @@ -11,7 +11,10 @@ def _(): import ollama 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 diff --git a/VB_interviews_sandbox.py b/VB_interviews_sandbox.py index da61743..20d1425 100644 --- a/VB_interviews_sandbox.py +++ b/VB_interviews_sandbox.py @@ -7,25 +7,35 @@ app = marimo.App(width="medium") @app.cell def _(): 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 -def _(): - import ollama - from ollama import Client - client = Client( - host='http://ollama-vb.tail44fa00.ts.net:11434' - ) +def _(Client, QUMO_OLLAMA_URL, requests): + try: + requests.get(QUMO_OLLAMA_URL, timeout=5) + client = Client( + 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,) @app.cell(hide_code=True) -def _(mo): - mo.md(r""" +def _(VM_NAME, mo): + mo.md(rf""" # 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... **if the connection fails, make sure Tailscale is up** @@ -66,7 +76,7 @@ def _(mo): @app.cell def _(client): - response_chat = client.chat(model='deepseek-r1:7b', messages=[ + response_chat = client.chat(model='deepseek-r1:32b', messages=[ { 'role': 'user', 'content': 'Why is the sky blue?',