ssh-AI commited on
Commit
6d34bc9
·
verified ·
1 Parent(s): ec220e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -7,9 +7,10 @@ from rembg import remove
7
  page_bg_img = '''
8
  <style>
9
  .stApp {
10
- background-image: url("https://images.unsplash.com/photo-1607746882042-944635dfe10e?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80");
11
  background-size: cover;
12
  background-position: center;
 
13
  }
14
  h1, h2, h3 {
15
  color: #ffffff;
@@ -49,18 +50,22 @@ if uploaded_files:
49
  cleaned_images.append(cleaned_img)
50
 
51
  if cleaned_images:
52
- # Save images into a single PDF
53
  pdf_bytes = io.BytesIO()
54
- cleaned_images[0].save(
55
- pdf_bytes,
56
- format="PDF",
57
- save_all=True,
58
- append_images=cleaned_images[1:],
59
- resolution=300.0 # Higher DPI
 
 
 
 
60
  )
61
  pdf_bytes.seek(0)
62
 
63
- st.success("✅ Images cleaned and combined into a PDF!")
64
  st.download_button(
65
  label="💾 Download Final PDF",
66
  data=pdf_bytes,
 
7
  page_bg_img = '''
8
  <style>
9
  .stApp {
10
+ background-image: url("https://images.unsplash.com/photo-1587620962725-abab7fe55159?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80");
11
  background-size: cover;
12
  background-position: center;
13
+ background-attachment: fixed;
14
  }
15
  h1, h2, h3 {
16
  color: #ffffff;
 
50
  cleaned_images.append(cleaned_img)
51
 
52
  if cleaned_images:
53
+ # Save images into a high-quality PDF
54
  pdf_bytes = io.BytesIO()
55
+ image_list = [img.convert('RGB') for img in cleaned_images] # Ensure correct mode
56
+ first_image = image_list.pop(0)
57
+
58
+ first_image.save(
59
+ pdf_bytes,
60
+ format="PDF",
61
+ save_all=True,
62
+ append_images=image_list,
63
+ resolution=300.0, # 300 DPI for quality
64
+ quality=100, # Maximum quality
65
  )
66
  pdf_bytes.seek(0)
67
 
68
+ st.success("✅ Images cleaned and combined into a high-quality PDF!")
69
  st.download_button(
70
  label="💾 Download Final PDF",
71
  data=pdf_bytes,