|
''' |
|
title: ollama chat demo |
|
''' |
|
|
|
import simplestart as ss |
|
import ollama |
|
|
|
ss.md("## ss.chat") |
|
|
|
setting = { |
|
"ollama_base_url": "http://localhost:11434", |
|
"model": "qwen:0.5b", |
|
"stream":False |
|
} |
|
|
|
def mychange(event): |
|
setting.update({ |
|
"model":mysel.value, |
|
"stream":mycheck.value, |
|
}) |
|
|
|
|
|
with ss.sidebar(): |
|
ss.md("#### Models and Parameters") |
|
ss.space() |
|
models = ss.ollama.get_models() |
|
|
|
mysel = ss.selectbox(models, index = 5, label = "Choose ollama models", onchange = mychange) |
|
|
|
mycheck = ss.checkbox("Streaming Output", onchange = mychange) |
|
|
|
|
|
mychat = ss.ollama.chat(demo = False, setting = setting) |
|
|