Spaces:
Runtime error
Runtime error
Upload 4 files
Browse files- Framework agent finder test 1.docx +0 -0
- app.py +62 -0
- frameworks.csv +4 -0
- requirements.txt +4 -0
Framework agent finder test 1.docx
ADDED
|
Binary file (17.2 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import pandas as pd
|
| 4 |
+
from sentence_transformers import SentenceTransformer
|
| 5 |
+
import numpy as np
|
| 6 |
+
import faiss
|
| 7 |
+
|
| 8 |
+
# Load data
|
| 9 |
+
df = pd.read_csv("frameworks.csv")
|
| 10 |
+
|
| 11 |
+
# Embed the scope column
|
| 12 |
+
model = SentenceTransformer("all-MiniLM-L6-v2")
|
| 13 |
+
scope_embeddings = model.encode(df["scope"].tolist())
|
| 14 |
+
index = faiss.IndexFlatL2(scope_embeddings.shape[1])
|
| 15 |
+
index.add(np.array(scope_embeddings))
|
| 16 |
+
|
| 17 |
+
st.set_page_config(page_title="AI Framework/DPS Finder", layout="centered")
|
| 18 |
+
st.title("π€ AI-Powered Framework & DPS Finder")
|
| 19 |
+
|
| 20 |
+
st.markdown("""Fill in your procurement details and our AI will recommend suitable frameworks or DPS options.""")
|
| 21 |
+
|
| 22 |
+
with st.form("proc_form"):
|
| 23 |
+
authority_type = st.selectbox("1. What type of contracting authority are you?", ["Local authority", "NHS", "Central government", "Utility"])
|
| 24 |
+
award_method = st.selectbox("2. Would you prefer to direct award or run a mini-competition?", ["Direct award", "Mini-competition", "Either"])
|
| 25 |
+
contract_value = st.number_input("3. Expected contract value (incl. VAT)", min_value=0)
|
| 26 |
+
duration = st.text_input("4. Expected contract duration (incl. extensions)")
|
| 27 |
+
description = st.text_area("5. Briefly describe the type of service needed and main deliverables")
|
| 28 |
+
submit = st.form_submit_button("π Find Frameworks")
|
| 29 |
+
|
| 30 |
+
if submit:
|
| 31 |
+
if description.strip() == "":
|
| 32 |
+
st.warning("Please enter a service description.")
|
| 33 |
+
else:
|
| 34 |
+
query_vec = model.encode([description])
|
| 35 |
+
D, I = index.search(np.array(query_vec), k=5)
|
| 36 |
+
candidates = df.iloc[I[0]]
|
| 37 |
+
|
| 38 |
+
# Filter based on authority, value cap, and award method
|
| 39 |
+
matches = candidates[
|
| 40 |
+
(candidates["authority_types"].str.contains(authority_type, case=False)) &
|
| 41 |
+
(candidates["value_cap"] >= contract_value) &
|
| 42 |
+
(
|
| 43 |
+
(award_method == "Either") |
|
| 44 |
+
((award_method == "Direct award") & (candidates["direct_award"] == "Yes")) |
|
| 45 |
+
((award_method == "Mini-competition") & (candidates["direct_award"] == "No"))
|
| 46 |
+
)
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
st.subheader("π Recommended Frameworks")
|
| 50 |
+
if matches.empty:
|
| 51 |
+
st.error("No suitable frameworks found. You may need to consider running a new procurement competition or expanding your criteria.")
|
| 52 |
+
else:
|
| 53 |
+
top_n = min(len(matches), 3)
|
| 54 |
+
for i in range(top_n):
|
| 55 |
+
row = matches.iloc[i]
|
| 56 |
+
st.success(f"β
{row['name']}")
|
| 57 |
+
st.markdown(f"- **Provider:** {row['provider']}")
|
| 58 |
+
st.markdown(f"- **Scope:** {row['scope']}")
|
| 59 |
+
st.markdown(f"- **Direct Award:** {row['direct_award']}")
|
| 60 |
+
st.markdown(f"- **Value Cap:** Β£{row['value_cap']:,}")
|
| 61 |
+
st.markdown(f"- [π View Framework]({row['link']})")
|
| 62 |
+
st.markdown("---")
|
frameworks.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name,provider,scope,direct_award,link,value_cap,authority_types
|
| 2 |
+
RM6259 β Case Management Software,CCS,"Cloud-based systems for local government, case management, digital services",Yes,https://www.crowncommercial.gov.uk/agreements/RM6259,250000,"Local authority,NHS"
|
| 3 |
+
ESPO 664 β HR Consultancy Services,ESPO,"HR advisory, organisational development, workforce planning",Yes,https://www.espo.org/Frameworks/HR-Consultancy,500000,"Local authority,Central government"
|
| 4 |
+
YPO 985 β IT and Case Management,YPO,"Social care case systems, education support platforms, digital workflow tools",No,https://www.ypo.co.uk/frameworks-home,300000,Local authority
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
sentence-transformers
|
| 4 |
+
faiss-cpu
|