slight UI simplification, clearer UX
This commit is contained in:
parent
599b773654
commit
cc8cc3face
2 changed files with 5 additions and 32 deletions
|
@ -20,12 +20,12 @@ class LlamaState: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadModel(modelUrl: URL?) throws {
|
func loadModel(modelUrl: URL?) throws {
|
||||||
messageLog += "Loading model...\n"
|
|
||||||
if let modelUrl {
|
if let modelUrl {
|
||||||
|
messageLog += "Loading model...\n"
|
||||||
llamaContext = try LlamaContext.create_context(path: modelUrl.path())
|
llamaContext = try LlamaContext.create_context(path: modelUrl.path())
|
||||||
messageLog += "Loaded model \(modelUrl.lastPathComponent)\n"
|
messageLog += "Loaded model \(modelUrl.lastPathComponent)\n"
|
||||||
} else {
|
} else {
|
||||||
messageLog += "Could not locate model, select one from the bottom list\n"
|
messageLog += "Select a model from the list\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,46 +42,28 @@ struct ContentView: View {
|
||||||
Button("Send") {
|
Button("Send") {
|
||||||
sendText()
|
sendText()
|
||||||
}
|
}
|
||||||
.padding(8)
|
|
||||||
.background(Color.blue)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.cornerRadius(8)
|
|
||||||
|
|
||||||
Button("Bench") {
|
Button("Bench") {
|
||||||
bench()
|
bench()
|
||||||
}
|
}
|
||||||
.padding(8)
|
|
||||||
.background(Color.blue)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.cornerRadius(8)
|
|
||||||
|
|
||||||
Button("Clear") {
|
Button("Clear") {
|
||||||
clear()
|
clear()
|
||||||
}
|
}
|
||||||
.padding(8)
|
|
||||||
.background(Color.blue)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.cornerRadius(8)
|
|
||||||
|
|
||||||
Button("Copy") {
|
Button("Copy") {
|
||||||
UIPasteboard.general.string = llamaState.messageLog
|
UIPasteboard.general.string = llamaState.messageLog
|
||||||
}
|
}
|
||||||
.padding(8)
|
}.buttonStyle(.bordered)
|
||||||
.background(Color.blue)
|
|
||||||
.foregroundColor(.white)
|
|
||||||
.cornerRadius(8)
|
|
||||||
}
|
|
||||||
|
|
||||||
VStack {
|
VStack(alignment: .leading) {
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
modelName: "TinyLlama-1.1B (Q4_0, 0.6 GiB)",
|
modelName: "TinyLlama-1.1B (Q4_0, 0.6 GiB)",
|
||||||
modelUrl: "https://huggingface.co/TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/resolve/main/tinyllama-1.1b-1t-openorca.Q4_0.gguf?download=true",
|
modelUrl: "https://huggingface.co/TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/resolve/main/tinyllama-1.1b-1t-openorca.Q4_0.gguf?download=true",
|
||||||
filename: "tinyllama-1.1b-1t-openorca.Q4_0.gguf"
|
filename: "tinyllama-1.1b-1t-openorca.Q4_0.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
.padding(.top, 4)
|
.padding(.top, 4)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
|
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
|
@ -89,7 +71,6 @@ struct ContentView: View {
|
||||||
modelUrl: "https://huggingface.co/TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/resolve/main/tinyllama-1.1b-1t-openorca.Q8_0.gguf?download=true",
|
modelUrl: "https://huggingface.co/TheBloke/TinyLlama-1.1B-1T-OpenOrca-GGUF/resolve/main/tinyllama-1.1b-1t-openorca.Q8_0.gguf?download=true",
|
||||||
filename: "tinyllama-1.1b-1t-openorca.Q8_0.gguf"
|
filename: "tinyllama-1.1b-1t-openorca.Q8_0.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
|
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
|
@ -97,8 +78,6 @@ struct ContentView: View {
|
||||||
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/tinyllama-1.1b/ggml-model-f16.gguf?download=true",
|
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/tinyllama-1.1b/ggml-model-f16.gguf?download=true",
|
||||||
filename: "tinyllama-1.1b-f16.gguf"
|
filename: "tinyllama-1.1b-f16.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
|
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
|
@ -106,7 +85,6 @@ struct ContentView: View {
|
||||||
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q4_0.gguf?download=true",
|
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q4_0.gguf?download=true",
|
||||||
filename: "phi-2-q4_0.gguf"
|
filename: "phi-2-q4_0.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
|
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
|
@ -114,8 +92,6 @@ struct ContentView: View {
|
||||||
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q8_0.gguf?download=true",
|
modelUrl: "https://huggingface.co/ggml-org/models/resolve/main/phi-2/ggml-model-q8_0.gguf?download=true",
|
||||||
filename: "phi-2-q8_0.gguf"
|
filename: "phi-2-q8_0.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
|
||||||
|
|
||||||
DownloadButton(
|
DownloadButton(
|
||||||
llamaState: llamaState,
|
llamaState: llamaState,
|
||||||
|
@ -123,15 +99,12 @@ struct ContentView: View {
|
||||||
modelUrl: "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_0.gguf?download=true",
|
modelUrl: "https://huggingface.co/TheBloke/Mistral-7B-v0.1-GGUF/resolve/main/mistral-7b-v0.1.Q4_0.gguf?download=true",
|
||||||
filename: "mistral-7b-v0.1.Q4_0.gguf"
|
filename: "mistral-7b-v0.1.Q4_0.gguf"
|
||||||
)
|
)
|
||||||
.font(.system(size: 12))
|
|
||||||
|
|
||||||
Button("Clear downloaded models") {
|
Button("Clear downloaded models") {
|
||||||
ContentView.cleanupModelCaches()
|
ContentView.cleanupModelCaches()
|
||||||
llamaState.cacheCleared = true
|
llamaState.cacheCleared = true
|
||||||
}
|
}
|
||||||
.padding(8)
|
}.font(.system(size: 12))
|
||||||
.font(.system(size: 12))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue