Spaces:
Sleeping
Sleeping
File size: 1,205 Bytes
e742708 531223c e742708 1781b9a e742708 531223c e742708 531223c e742708 531223c e742708 531223c e742708 531223c e742708 531223c e742708 531223c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import streamlit as st
import requests
from datetime import datetime
st.set_page_config(page_title="FYP Dashboard", layout="wide")
st.title("π Multi-Agent Knowledge System Dashboard")
api_url = "https://fyp1-api.onrender.com"
st.header("π Metrics")
col1, col2, col3, col4 = st.columns(4)
try:
metrics = requests.get(f"{api_url}/metrics").json()
col1.metric("Total Queries", metrics.get("total_queries", 0))
col2.metric("Avg Latency (ms)", f"{metrics.get('avg_latency_ms', 0):.0f}")
col3.metric("Avg Confidence", f"{metrics.get('avg_confidence', 0):.0%}")
col4.metric("Cache Hit Rate", f"{metrics.get('cache_hit_rate', 0):.0%}")
except:
st.error("Cannot connect to API")
st.divider()
st.header("π§ͺ Test Query")
query = st.text_input("Enter query:", "What is FastAPI?")
if st.button("Send", key="unique_send"):
response = requests.post(f"{api_url}/query", json={"query": query}).json()
st.write(response.get("answer"))
st.metric("Confidence", f"{response['validation']['confidence']}%")
st.divider()
st.header("π₯ Health")
try:
health = requests.get(f"{api_url}/health").json()
st.success("β
API Running")
except:
st.error("β API Down")
|