Utsav2001 commited on
Commit
260127a
Β·
verified Β·
1 Parent(s): a5f8d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -23,7 +23,7 @@ scheduler = CommitScheduler(
23
  )
24
 
25
  # Streamlit UI
26
- st.title("Feedback-enabled Chatbot with Hugging Face Integration")
27
 
28
  if "prompts" not in st.session_state:
29
  st.session_state.prompts = []
@@ -33,6 +33,8 @@ if "show_feedback" not in st.session_state:
33
  st.session_state.show_feedback = False
34
  if "feedbacks" not in st.session_state:
35
  st.session_state.feedbacks = []
 
 
36
 
37
  # Function to save data using Hugging Face CommitScheduler
38
  def save_feedback_to_hub(prompt, ai_response, feedback_type, feedback_comment):
@@ -71,14 +73,13 @@ if st.session_state.show_feedback and len(st.session_state.prompts) > 0 and len(
71
  st.write("Provide feedback for the last interaction:")
72
 
73
  col1, col2 = st.columns(2)
74
- feedback_type = None
75
  with col1:
76
  if st.button("πŸ‘ Thumbs Up"):
77
- feedback_type = "Positive"
78
  st.session_state.show_feedback_box = True
79
  with col2:
80
  if st.button("πŸ‘Ž Thumbs Down"):
81
- feedback_type = "Negative"
82
  st.session_state.show_feedback_box = True
83
 
84
  if "show_feedback_box" in st.session_state and st.session_state.show_feedback_box:
@@ -87,7 +88,7 @@ if st.session_state.show_feedback and len(st.session_state.prompts) > 0 and len(
87
  save_status = save_feedback_to_hub(
88
  st.session_state.prompts[-1],
89
  st.session_state.responses[-1],
90
- feedback_type,
91
  feedback_comment
92
  )
93
  st.success(save_status)
 
23
  )
24
 
25
  # Streamlit UI
26
+ st.title("OpenROAD-Assistant")
27
 
28
  if "prompts" not in st.session_state:
29
  st.session_state.prompts = []
 
33
  st.session_state.show_feedback = False
34
  if "feedbacks" not in st.session_state:
35
  st.session_state.feedbacks = []
36
+ if "feedback_type" not in st.session_state:
37
+ st.session_state.feedback_type = None
38
 
39
  # Function to save data using Hugging Face CommitScheduler
40
  def save_feedback_to_hub(prompt, ai_response, feedback_type, feedback_comment):
 
73
  st.write("Provide feedback for the last interaction:")
74
 
75
  col1, col2 = st.columns(2)
 
76
  with col1:
77
  if st.button("πŸ‘ Thumbs Up"):
78
+ st.session_state.feedback_type = "Positive"
79
  st.session_state.show_feedback_box = True
80
  with col2:
81
  if st.button("πŸ‘Ž Thumbs Down"):
82
+ st.session_state.feedback_type = "Negative"
83
  st.session_state.show_feedback_box = True
84
 
85
  if "show_feedback_box" in st.session_state and st.session_state.show_feedback_box:
 
88
  save_status = save_feedback_to_hub(
89
  st.session_state.prompts[-1],
90
  st.session_state.responses[-1],
91
+ st.session_state.feedback_type,
92
  feedback_comment
93
  )
94
  st.success(save_status)