Spaces:
Runtime error
Runtime error
Update app.py
Browse files46 unmodified lines474849505152535455564 unmodified lines6162636465666768697071727374757646 unmodified linesst.write("Please paste the HTML piece code, not the URL")html_content = Noneextract_button = st.button("Extract data format")if html_content and extract_button:try:output = gpt_assistant.chain_response_format(html_content)st.session_state['output_format'] = outputexcept NameError:4 unmodified linesif 'output_format' in st.session_state:output_format = st.code(st.session_state['output_format'], language="json")if st.button("Generate the code"):try:python_code = gpt_assistant.chain_code_generator(st.session_state['output_format'], html_content)st.session_state['code_generated'] = python_codest.session_state['code_generated_exec'] = python_code + "\nresult = extract_info(html_data)"except NameError:st.write("Complete the API key field")except AuthenticationError:st.write("Invalid API key")@traceable(run_type="tool")def test_the_code(code, full_content):46 unmodified lines47484950515253545556574 unmodified lines6263646566676869707172737475767746 unmodified linesst.write("Please paste the HTML piece code, not the URL")html_content = Noneextract_button = st.button("Generate output format & code")if html_content and extract_button:try:st.write("1/2: Generating the output format...")output = gpt_assistant.chain_response_format(html_content)st.session_state['output_format'] = outputexcept NameError:4 unmodified linesif 'output_format' in st.session_state:output_format = st.code(st.session_state['output_format'], language="json")try:st.write("2/2: Generating the code...")python_code = gpt_assistant.chain_code_generator(st.session_state['output_format'], html_content)st.session_state['code_generated'] = python_codest.session_state['code_generated_exec'] = python_code + "\nresult = extract_info(html_data)"except NameError:st.write("Complete the API key field")except AuthenticationError:st.write("Invalid API key")@traceable(run_type="tool")def test_the_code(code, full_content):
app.py+12-11