mroccuper commited on
Commit
eef0eb0
·
verified ·
1 Parent(s): b3aa6d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -80,8 +80,14 @@ def app_interface(html_file, tones, platform_choice, api_key):
80
  return "Please upload an HTML blog post."
81
 
82
  print("[app_interface] Reading HTML file...")
83
- html_bytes = html_file.read()
84
- html_content = html_bytes.decode("utf-8")
 
 
 
 
 
 
85
  main_text = extract_main_content(html_content)
86
  if not main_text:
87
  return "Couldn't extract content from file. Ensure it's a valid HTML blog post."
 
80
  return "Please upload an HTML blog post."
81
 
82
  print("[app_interface] Reading HTML file...")
83
+
84
+ if hasattr(html_file, "name"):
85
+ with open(html_file.name, "r", encoding="utf-8") as f:
86
+ html_content = f.read()
87
+ else:
88
+ html_bytes = html_file.read()
89
+ html_content = html_bytes.decode("utf-8")
90
+
91
  main_text = extract_main_content(html_content)
92
  if not main_text:
93
  return "Couldn't extract content from file. Ensure it's a valid HTML blog post."