import streamlit as st import requests st.set_page_config(page_title="Flykite HR Interface", layout="wide") st.title("🛫 Flykite Airlines HR QnA Assistant Portal") # Replace this string with your backend Space API link API_ENDPOINT = "https://SagarAtHf-flykite-model-backend.hf.space/api/generate" st.sidebar.header("🛠️ Model Hyperparameters") chunk_size = st.sidebar.slider("Chunk Size", 300, 1500, 1000, 50) chunk_overlap = st.sidebar.slider("Chunk Overlap", 0, 300, 100, 25) k_depth = st.sidebar.slider("Retrieval Depth (k)", 1, 5, 3, 1) temperature = st.sidebar.slider("Temperature", 0.01, 1.00, 0.20, 0.05) top_p = st.sidebar.slider("Top-P", 0.50, 1.00, 0.90, 0.05) user_query = st.text_input("Submit policy query:") if user_query: payload = { "question": user_query, "chunk_size": chunk_size, "chunk_overlap": chunk_overlap, "k_depth": k_depth, "temperature": temperature, "top_p": top_p } with st.spinner("Processing request via remote AI Model Server..."): try: res = requests.post(API_ENDPOINT, json=payload, timeout=12000) if res.status_code == 200: data = res.json() st.subheader("📋 Assistant Response") st.info(data["answer"]) with st.expander("🔍 Inspect Audit Context Trail Chunks"): for idx, item in enumerate(data["audit_trail"]): st.markdown(f"**Chunk {idx+1} | Page {item['page']}**") st.code(item['content'], language="text") else: st.error(f"Error {res.status_code}: {res.text}") except Exception as e: st.error(f"Connection error: {str(e)}")