wholewhale commited on
Commit
6abee2b
·
1 Parent(s): 4659cc6
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -68,16 +68,13 @@ def pdf_changes(pdf_doc):
68
  documents = load_documents(pdf_doc)
69
  global full_summary
70
  full_summary = generate_summary(documents)
71
- summary_state.value = full_summary
72
- global db, qa
73
- db, qa = setup_retrieval(documents)
74
- summary_box.set_value(full_summary)
75
  return f"Ready. Full Summary loaded."
76
  except Exception as e:
77
  return f"Error processing PDF: {str(e)}"
78
 
79
 
80
-
81
  def clear_data():
82
  global qa, db
83
  qa = None
@@ -169,7 +166,8 @@ with gr.Blocks(css=css) as demo:
169
  placeholder="Summary will appear here.",
170
  interactive=False,
171
  rows=5,
172
- elem_id="summary_box" # Set the elem_id to match the state key
 
173
  )
174
 
175
 
@@ -192,4 +190,4 @@ with gr.Blocks(css=css) as demo:
192
  bot, chatbot, chatbot
193
  )
194
 
195
- demo.launch()
 
68
  documents = load_documents(pdf_doc)
69
  global full_summary
70
  full_summary = generate_summary(documents)
71
+ summary_state.value = full_summary # Update the state variable
72
+ # ... (rest of your code)
 
 
73
  return f"Ready. Full Summary loaded."
74
  except Exception as e:
75
  return f"Error processing PDF: {str(e)}"
76
 
77
 
 
78
  def clear_data():
79
  global qa, db
80
  qa = None
 
166
  placeholder="Summary will appear here.",
167
  interactive=False,
168
  rows=5,
169
+ elem_id="summary_box",
170
+ state=summary_state # Bind the state here
171
  )
172
 
173
 
 
190
  bot, chatbot, chatbot
191
  )
192
 
193
+ demo.launch()