rodolphethinks1 commited on
Commit
592392b
·
verified ·
1 Parent(s): d08b4ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -46,7 +46,6 @@ def parse_content(html_content):
46
  df = pd.DataFrame([parsed_data])
47
  return df
48
 
49
- # Define the Gradio interface
50
  def process_input(html_content):
51
  try:
52
  df = parse_content(html_content)
@@ -54,11 +53,13 @@ def process_input(html_content):
54
  except Exception as e:
55
  return f"Error: {e}"
56
 
57
- interface = gr.Interface(
58
- fn=process_input,
59
- inputs=gr.Textbox(label="Paste HTML Content", lines=10, placeholder="Paste your HTML content here..."),
60
- outputs=gr.Dataframe(label="Parsed Data")
61
- )
 
 
 
62
 
63
- # Launch the app
64
- interface.launch()
 
46
  df = pd.DataFrame([parsed_data])
47
  return df
48
 
 
49
  def process_input(html_content):
50
  try:
51
  df = parse_content(html_content)
 
53
  except Exception as e:
54
  return f"Error: {e}"
55
 
56
+ with gr.Blocks() as interface:
57
+ with gr.Column():
58
+ gr.Markdown("## HTML Content Parser")
59
+ html_input = gr.Textbox(label="Paste HTML Content", lines=10, placeholder="Paste your HTML content here...")
60
+ parse_button = gr.Button("Parse Content")
61
+ parsed_output = gr.Dataframe(label="Parsed Data")
62
+
63
+ parse_button.click(fn=process_input, inputs=html_input, outputs=parsed_output)
64
 
65
+ interface.launch()