Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,11 +30,18 @@ agent = initialize_agent(
|
|
30 |
def azure_cert_bot(cert_name):
|
31 |
query = f"Microsoft Azure {cert_name} certification curriculum site:microsoft.com"
|
32 |
search_results = ddgs.run(query).split("\n")
|
33 |
-
prompt = f"Based on the following curriculum details, generate key questions and answers in markdown format for the {cert_name} certification exam:\n{search_results}"
|
34 |
response = llm.invoke(prompt)
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
|
|
38 |
st.set_page_config(page_title="Azure Certification Prep Assistant", layout="wide")
|
39 |
|
40 |
# Custom Styling
|
@@ -82,4 +89,3 @@ if st.button("Get Certification Details"):
|
|
82 |
st.markdown(f"<div class='markdown-text-container'>{qa_content}</div>", unsafe_allow_html=True)
|
83 |
else:
|
84 |
st.warning("Please enter a certification name.")
|
85 |
-
|
|
|
30 |
def azure_cert_bot(cert_name):
|
31 |
query = f"Microsoft Azure {cert_name} certification curriculum site:microsoft.com"
|
32 |
search_results = ddgs.run(query).split("\n")
|
33 |
+
prompt = f"Based on the following curriculum details, generate key questions and answers in markdown format for the {cert_name} certification exam. Do not include any metadata or unnecessary text, only return the formatted Q&A:\n{search_results}"
|
34 |
response = llm.invoke(prompt)
|
35 |
|
36 |
+
try:
|
37 |
+
response_text = response.get("content", "No response generated.") if isinstance(response, dict) else response
|
38 |
+
response_text = "\n".join([line for line in response_text.split("\n") if not line.lower().startswith("content=") and "metadata" not in line.lower()])
|
39 |
+
except Exception as e:
|
40 |
+
response_text = f"Error processing response: {str(e)}"
|
41 |
+
|
42 |
+
return search_results, response_text
|
43 |
|
44 |
+
# Streamlit UI Enhancements
|
45 |
st.set_page_config(page_title="Azure Certification Prep Assistant", layout="wide")
|
46 |
|
47 |
# Custom Styling
|
|
|
89 |
st.markdown(f"<div class='markdown-text-container'>{qa_content}</div>", unsafe_allow_html=True)
|
90 |
else:
|
91 |
st.warning("Please enter a certification name.")
|
|