Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,10 +11,9 @@ def fetch_response(query):
|
|
11 |
def display_sources(sources):
|
12 |
with st.expander("Show Sources"):
|
13 |
for source in sources:
|
14 |
-
st.markdown(f"[{source['title']}]({source['link']})")
|
15 |
|
16 |
def main():
|
17 |
-
|
18 |
st.title("AI Response Analytics Tool")
|
19 |
|
20 |
# User input
|
@@ -24,20 +23,17 @@ def main():
|
|
24 |
if submit_button and user_query:
|
25 |
# Fetching response from Meta AI
|
26 |
response = fetch_response(user_query)
|
27 |
-
|
28 |
-
# Display the
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
# Display sources with clickable links in a collapsible section
|
33 |
if 'sources' in response:
|
34 |
display_sources(response['sources'])
|
35 |
|
36 |
-
#
|
37 |
-
#
|
38 |
-
|
39 |
-
# Optionally, save the query and response for historical analysis
|
40 |
-
# Implement data storage if needed
|
41 |
|
42 |
if __name__ == "__main__":
|
43 |
-
main()
|
|
|
11 |
def display_sources(sources):
|
12 |
with st.expander("Show Sources"):
|
13 |
for source in sources:
|
14 |
+
st.markdown(f"[{source['title']}]({source['link']})", unsafe_allow_html=True)
|
15 |
|
16 |
def main():
|
|
|
17 |
st.title("AI Response Analytics Tool")
|
18 |
|
19 |
# User input
|
|
|
23 |
if submit_button and user_query:
|
24 |
# Fetching response from Meta AI
|
25 |
response = fetch_response(user_query)
|
26 |
+
|
27 |
+
# Display the AI response directly
|
28 |
+
st.write("### AI Response")
|
29 |
+
st.write(response['message'])
|
30 |
+
|
31 |
# Display sources with clickable links in a collapsible section
|
32 |
if 'sources' in response:
|
33 |
display_sources(response['sources'])
|
34 |
|
35 |
+
# Additional features such as sentiment analysis, keyword extraction, and response analysis can be added here.
|
36 |
+
# Optionally, consider saving queries and responses for historical analysis or comparison.
|
|
|
|
|
|
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
+
main()
|