cstr commited on
Commit
270d07a
·
verified ·
1 Parent(s): 0b93651

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -262,6 +262,10 @@ def process_pdf(pdf, fmt, ctx_size, snippet_num, prompt):
262
  logging.error(f"Error processing PDF: {e}")
263
  return f"Error processing PDF: {str(e)}", "", []
264
 
 
 
 
 
265
  # Main Interface
266
  with gr.Blocks(theme=gr.themes.Default()) as demo:
267
  # Store context size value
@@ -425,13 +429,6 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
425
  outputs=[hf_options, groq_options, openai_options]
426
  )
427
 
428
- for btn, size_value in context_buttons:
429
- btn.click(
430
- lambda v=size_value: v, # Simplified to directly return the value
431
- None,
432
- context_size
433
- )
434
-
435
  hf_model.change(
436
  toggle_custom_model,
437
  inputs=[hf_model],
 
262
  logging.error(f"Error processing PDF: {e}")
263
  return f"Error processing PDF: {str(e)}", "", []
264
 
265
+ The main error is the context_size not being defined before it's used in the button click handlers. Let's fix the order of component definitions and handlers. Here's the corrected UI section:
266
+ python
267
+
268
+ Copy
269
  # Main Interface
270
  with gr.Blocks(theme=gr.themes.Default()) as demo:
271
  # Store context size value
 
429
  outputs=[hf_options, groq_options, openai_options]
430
  )
431
 
 
 
 
 
 
 
 
432
  hf_model.change(
433
  toggle_custom_model,
434
  inputs=[hf_model],