Spaces:
Paused
Paused
Update app.py
Browse files261 unmodified lines262263264265266267157 unmodified lines425426427428429430431432433434435436437261 unmodified lineslogging.error(f"Error processing PDF: {e}")return f"Error processing PDF: {str(e)}", "", []# Main Interfacewith gr.Blocks(theme=gr.themes.Default()) as demo:# Store context size value157 unmodified linesoutputs=[hf_options, groq_options, openai_options])for btn, size_value in context_buttons:btn.click(lambda v=size_value: v, # Simplified to directly return the valueNone,context_size)hf_model.change(toggle_custom_model,inputs=[hf_model],261 unmodified lines262263264265266267268269270271157 unmodified lines429430431432433434261 unmodified lineslogging.error(f"Error processing PDF: {e}")return f"Error processing PDF: {str(e)}", "", []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:pythonCopy# Main Interfacewith gr.Blocks(theme=gr.themes.Default()) as demo:# Store context size value157 unmodified linesoutputs=[hf_options, groq_options, openai_options])hf_model.change(toggle_custom_model,inputs=[hf_model],
app.py+4-7