Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/691c1dba-9228-800f-8463-13b3a9006306
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Fixes the API parsing, matches the real JSON shape returned by Ooba’s web UI. === Save as: hpl_runner_webui.py <syntaxhighlight lang="python">#!/usr/bin/env python3 import json, hashlib, requests, time, os API = os.environ.get("YAIY_LLM_API", "http://127.0.0.1:5000/api/v1/generate") TIMEOUT = 90 def call_webui(prompt, max_tokens=512): payload = { "prompt": prompt, "max_new_tokens": max_tokens, "do_sample": True, "temperature": 0.7, "top_p": 0.9, "typical_p": 0.95 } r = requests.post(API, json=payload, timeout=TIMEOUT) r.raise_for_status() data = r.json() # THIS IS THE REAL STRUCTURE: # {"results": [{"text": "model output..."}]} if "results" in data and len(data["results"]) > 0: return data["results"][0]["text"].strip() return str(data) def carousel_ingot(lines, title="session"): text = "\n".join(lines).encode() digest = hashlib.sha256(text).hexdigest()[:32] syn = lines[-3:] if len(lines) > 3 else lines return {"title": title, "hash": digest, "synopsis": syn} def run_manifest(manifest_path, context=""): manifest = json.load(open(manifest_path)) logs = [] for step in manifest["steps"]: p = f""" --- Step ID: {step['id']} Action: {step['do']} Context: {context} --- """ out = call_webui(p) logs.append(out) time.sleep(0.2) ingot = carousel_ingot(logs, title=manifest["title"]) return {"logs": logs, "ingot": ingot} if __name__ == "__main__": import argparse p = argparse.ArgumentParser() p.add_argument("manifest") p.add_argument("--context", default="Architect: Benjy") a = p.parse_args() print(json.dumps(run_manifest(a.manifest, a.context), indent=2)) </syntaxhighlight> ===== - Perfect for your GUI-based workflow ===== * Stable output extraction * Supports all quantized GPTQ + GGML models loaded into webui * Works with your dual-GPU setup
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)