Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1#!/usr/bin/env python32import http.server, socketserver, urllib.request, urllib.error, os3PORT = int(os.environ.get('GATEWAY_PORT', 8080))4TARGET = os.environ.get('AI_TARGET', 'https://api.openai.com/v1')5KEY = os.environ.get('AI_KEY', '')6class H(http.server.BaseHTTPRequestHandler):7 def do_POST(self):8 if self.path != '/v1/chat/completions': return self.send_error(404)9 cl = int(self.headers.get('Content-Length', 0))10 body = self.rfile.read(cl)11 hdrs = {'Authorization': f'Bearer {KEY}', 'Content-Type': 'application/json'}12 req = urllib.request.Request(f'{TARGET}{self.path}', data=body, headers=hdrs, method='POST')13 try:14 with urllib.request.urlopen(req) as r:15 self.send_response(200)16 self.send_header('Content-Type', 'application/json')17 self.end_headers()18 self.wfile.write(r.read())19 except urllib.error.HTTPError as e:20 self.send_response(e.code)21 self.end_headers()22 self.wfile.write(e.read())23 def log_message(self, *a): print(f'CONN: {self.client_address[0]}', flush=True)24if __name__=='__main__':25 socketserver.TCPServer.allow_reuse_address = True26 with socketserver.TCPSemaphore(('', PORT), H) as s: s.serve_forever()