Spaces:
Runtime error
Runtime error
added fixed buttons
Browse files
app.py
CHANGED
@@ -20,15 +20,15 @@ else:
|
|
20 |
|
21 |
html_content = st.text_input("Paste your piece of HTML here:")
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
|
33 |
if 'output_format' in st.session_state:
|
34 |
output_format = st.code(st.session_state['output_format'], language="json")
|
@@ -49,7 +49,8 @@ if 'code_generated' in st.session_state:
|
|
49 |
python_function_label = st.write("Here is your python function:")
|
50 |
code_generated = st.code(st.session_state['code_generated'],language="python")
|
51 |
full_content = st.text_input("Paste your complete HTML here:")
|
52 |
-
|
|
|
53 |
html_data = full_content
|
54 |
result = None
|
55 |
exec(st.session_state['code_generated_exec'], globals())
|
|
|
20 |
|
21 |
html_content = st.text_input("Paste your piece of HTML here:")
|
22 |
|
23 |
+
extract_button = st.button("Extract data format")
|
24 |
+
if html_content and extract_button:
|
25 |
+
try:
|
26 |
+
output = gpt_assistant.chain_response_format(html_content)
|
27 |
+
st.session_state['output_format'] = output
|
28 |
+
except NameError:
|
29 |
+
st.write("Complete the API key field")
|
30 |
+
except AuthenticationError:
|
31 |
+
st.write("Invalid API key")
|
32 |
|
33 |
if 'output_format' in st.session_state:
|
34 |
output_format = st.code(st.session_state['output_format'], language="json")
|
|
|
49 |
python_function_label = st.write("Here is your python function:")
|
50 |
code_generated = st.code(st.session_state['code_generated'],language="python")
|
51 |
full_content = st.text_input("Paste your complete HTML here:")
|
52 |
+
test_code = st.button("Test the code")
|
53 |
+
if full_content and test_code:
|
54 |
html_data = full_content
|
55 |
result = None
|
56 |
exec(st.session_state['code_generated_exec'], globals())
|