cyberandy commited on
Commit
a030ddc
·
verified ·
1 Parent(s): 45702d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -9,11 +9,12 @@ def fetch_response(query):
9
  return response
10
 
11
  def display_sources(sources):
12
- st.write("### Sources")
13
- for source in sources:
14
- st.markdown(f"[{source['title']}]({source['link']})")
15
 
16
  def main():
 
17
  st.title("AI Response Analytics Tool")
18
 
19
  # User input
@@ -23,18 +24,17 @@ def main():
23
  if submit_button and user_query:
24
  # Fetching response from Meta AI
25
  response = fetch_response(user_query)
26
- st.write("### AI Response")
27
- st.write(response['message'])
28
 
29
- # Display sources with clickable links
 
 
 
 
30
  if 'sources' in response:
31
  display_sources(response['sources'])
32
 
33
- # Here you might add further analysis of the response, such as:
34
- # - Text analysis for sentiment
35
- # - Keyword extraction
36
- # - Length of the response
37
- # - Etc.
38
 
39
  # Optionally, save the query and response for historical analysis
40
  # Implement data storage if needed
 
9
  return response
10
 
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
  if submit_button and user_query:
25
  # Fetching response from Meta AI
26
  response = fetch_response(user_query)
 
 
27
 
28
+ # Display the full AI response in a collapsible section
29
+ with st.expander("Show Full Response"):
30
+ st.write(response['message'])
31
+
32
+ # Display sources with clickable links in a collapsible section
33
  if 'sources' in response:
34
  display_sources(response['sources'])
35
 
36
+ # Further features for processing and visualizing the response could be added here
37
+ # Examples: sentiment analysis, keyword extraction, response length, etc.
 
 
 
38
 
39
  # Optionally, save the query and response for historical analysis
40
  # Implement data storage if needed