import gradio as gr from bedrock_client import claude_llm from utils import load_users AUTHS = load_users('user.csv') def chat(user_message, history): # append the user message messages = history + [{"role":"user","content":user_message}] # pick the right LLM llm = claude_llm full = "" # stream tokens as they arrive for token in llm.stream(user_message): full += token # yield an updated history snapshot yield messages + [{"role":"assistant","content": full}] # final history messages.append({"role":"assistant","content":full}) yield messages with gr.Blocks(css_paths=["static/deval.css"],theme = gr.themes.Default(primary_hue="blue", secondary_hue="yellow"),) as demo: # ── Logo + Header + Logout ──────────────────────────────── gr.Image( value="static/logo.png", show_label=False, interactive=False, show_download_button=False, show_fullscreen_button=False, elem_id="logo-primary", # matches the CSS above ) #logout_btn = gr.Button("Logout", elem_id="logout-btn") # inject auto-reload script gr.HTML( """ """ ) gr.ChatInterface( chat, type="messages", editable=True, concurrency_limit=200, save_history=True, ) demo.queue() \ .launch(auth=AUTHS)