Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,13 @@ import os
|
|
6 |
import tempfile
|
7 |
|
8 |
def compress_pdf(input_file, url, quality):
|
9 |
-
if input_file is None and url is None:
|
10 |
return None, "Please provide either a file or a URL."
|
11 |
|
12 |
-
if input_file is not None and url
|
13 |
return None, "Please provide either a file or a URL, not both."
|
14 |
|
15 |
-
if url:
|
16 |
try:
|
17 |
response = requests.get(url)
|
18 |
response.raise_for_status()
|
|
|
6 |
import tempfile
|
7 |
|
8 |
def compress_pdf(input_file, url, quality):
|
9 |
+
if input_file is None and (url is None or url.strip() == ""):
|
10 |
return None, "Please provide either a file or a URL."
|
11 |
|
12 |
+
if input_file is not None and url and url.strip() != "":
|
13 |
return None, "Please provide either a file or a URL, not both."
|
14 |
|
15 |
+
if url and url.strip() != "":
|
16 |
try:
|
17 |
response = requests.get(url)
|
18 |
response.raise_for_status()
|