Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
-
from utils import
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
st.title("π PPRA Tender Co-Pilot")
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
st.
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
st.
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
import streamlit as st
|
| 4 |
+
from model_config import query_llm
|
| 5 |
+
from utils import extract_text_from_pdf
|
| 6 |
+
|
| 7 |
+
st.set_page_config(page_title="PPRA Co-Pilot π΅π°", layout="centered")
|
| 8 |
|
| 9 |
st.title("π PPRA Tender Co-Pilot")
|
| 10 |
+
st.subheader("Your AI Assistant for Government Tender Understanding")
|
| 11 |
+
|
| 12 |
+
name = st.text_input("Enter your name (for personalization):", "")
|
| 13 |
+
|
| 14 |
+
uploaded_file = st.file_uploader("Upload a Tender Document (PDF)", type=["pdf"])
|
| 15 |
+
|
| 16 |
+
if uploaded_file:
|
| 17 |
+
with st.spinner("Reading your tender..."):
|
| 18 |
+
text = extract_text_from_pdf(uploaded_file)
|
| 19 |
+
|
| 20 |
+
st.text_area("π Tender Preview:", value=text[:1000], height=250)
|
| 21 |
+
|
| 22 |
+
if st.button("π Analyze with AI"):
|
| 23 |
+
with st.spinner("Thinking..."):
|
| 24 |
+
prompt = f"""You are a helpful assistant for government tenders in Pakistan.
|
| 25 |
+
A user named {name or "User"} has uploaded the following tender:
|
| 26 |
+
|
| 27 |
+
{text[:2000]}
|
| 28 |
+
|
| 29 |
+
Summarize the key points, list the eligibility criteria, and suggest action steps for participation. Keep it concise and beginner-friendly."""
|
| 30 |
+
response = query_llm(prompt)
|
| 31 |
+
st.success("β
AI Response:")
|
| 32 |
+
st.markdown(response)
|