mery22 commited on
Commit
91eb818
·
verified ·
1 Parent(s): e11d4a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -86,11 +86,13 @@ def insert_feedback(rating, comment):
86
  cur.execute('INSERT INTO feedback (timestamp, rating, comment) VALUES (%s, %s, %s)',
87
  (timestamp, int(rating), comment))
88
  conn.commit()
89
- print('submitted')
90
  return True
91
  except Exception as e:
92
  st.error(f"Error inserting feedback: {e}")
93
  return False
 
 
 
94
 
95
  # Streamlit interface with improved aesthetics
96
  st.set_page_config(page_title="Alter-IA Chat", page_icon="🤖")
@@ -175,7 +177,6 @@ if submit_button:
175
  st.success("Thank you for your feedback!")
176
  else:
177
  st.error("Failed to submit feedback.")
178
-
179
  else:
180
  st.warning("⚠ Please enter a message.")
181
 
 
86
  cur.execute('INSERT INTO feedback (timestamp, rating, comment) VALUES (%s, %s, %s)',
87
  (timestamp, int(rating), comment))
88
  conn.commit()
 
89
  return True
90
  except Exception as e:
91
  st.error(f"Error inserting feedback: {e}")
92
  return False
93
+ finally:
94
+ if conn:
95
+ conn.close()
96
 
97
  # Streamlit interface with improved aesthetics
98
  st.set_page_config(page_title="Alter-IA Chat", page_icon="🤖")
 
177
  st.success("Thank you for your feedback!")
178
  else:
179
  st.error("Failed to submit feedback.")
 
180
  else:
181
  st.warning("⚠ Please enter a message.")
182