wholewhale commited on
Commit
df75cae
·
1 Parent(s): 4dcf9b3

update summary GR box

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -67,7 +67,7 @@ def pdf_changes(pdf_doc):
67
  retriever=retriever,
68
  return_source_documents=False
69
  )
70
-
71
  return f"Ready. Full Summary loaded."
72
 
73
  except Exception as e:
@@ -116,7 +116,7 @@ def infer(question, history):
116
  return f"Error querying chatbot: {str(e)}"
117
 
118
  def auto_clear_data():
119
- global qa, da, last_interaction_time
120
  if time.time() - last_interaction_time > 1000:
121
  qa = None
122
  db = None
@@ -160,8 +160,14 @@ with gr.Blocks(css=css) as demo:
160
  clear_btn = gr.Button("Clear Data")
161
 
162
  # New Textbox to display summary
163
- summary_box = gr.Textbox(label="Document Summary", placeholder="Summary will appear here.",
164
- interactive=False, rows=5, elem_id="summary_box")
 
 
 
 
 
 
165
 
166
  chatbot = gr.Chatbot([], elem_id="chatbot").style(height=450)
167
  question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter")
 
67
  retriever=retriever,
68
  return_source_documents=False
69
  )
70
+ summary_box.update(full_summary)
71
  return f"Ready. Full Summary loaded."
72
 
73
  except Exception as e:
 
116
  return f"Error querying chatbot: {str(e)}"
117
 
118
  def auto_clear_data():
119
+ global qa, db, last_interaction_time
120
  if time.time() - last_interaction_time > 1000:
121
  qa = None
122
  db = None
 
160
  clear_btn = gr.Button("Clear Data")
161
 
162
  # New Textbox to display summary
163
+ summary_box = gr.Textbox(
164
+ label="Document Summary",
165
+ placeholder="Summary will appear here.",
166
+ interactive=False,
167
+ rows=5,
168
+ elem_id="summary_box" # Set the elem_id to match the state key
169
+ )
170
+
171
 
172
  chatbot = gr.Chatbot([], elem_id="chatbot").style(height=450)
173
  question = gr.Textbox(label="Question", placeholder="Type your question and hit Enter")