Update app.py
Browse files232 unmodified lines233234235236237238239240241242272 unmodified lines515516517518519520232 unmodified linesfull_response += chunkexcept Exception as e:print(f"Error in generate_chunked_response: {e}")if "Input validation error" in str(e):# If we hit the token limit, return what we have so farreturn full_response if full_response else "The input was too long to process. Please try a shorter query."breakreturn full_response.strip()def extract_text_from_webpage(html):272 unmodified linesfull_response = '\n'.join(lines)return full_response.strip()# Gradio interfacewith gr.Blocks() as demo:232 unmodified lines233234235236237238239240241242243272 unmodified lines516517518519520521522523524525526232 unmodified linesfull_response += chunkexcept Exception as e:print(f"Error in generate_chunked_response: {e}")print(f"Prompt: {prompt}")print(f"Full response so far: {full_response}")if "Input validation error" in str(e):return full_response if full_response else "The input was too long to process. Please try a shorter query."raise # Re-raise the exception to be caught in ask_questionreturn full_response.strip()def extract_text_from_webpage(html):272 unmodified linesfull_response = '\n'.join(lines)return full_response.strip()except Exception as e:print(f"Error in extract_answer: {e}")print(f"Full response: {full_response}")print(f"Instructions: {instructions}")raise # Re-raise the exception to be caught in ask_question# Gradio interfacewith gr.Blocks() as demo:
app.py+8-2