JerryCoder commited on
Commit
5497583
·
verified ·
1 Parent(s): 148a81d

© 2025 by JerryCoder

Browse files
Files changed (1) hide show
  1. app.py +13 -16
app.py CHANGED
@@ -50,26 +50,23 @@ def process_image(img_bytes: bytes):
50
  output_bytes = remove(img_bytes)
51
 
52
  # Upload to tmpfiles (temporary hosting)
53
- files = {"file": ("output.png", output_bytes, "image/png")}
54
- r = requests.post("https://tmpfiles.org/api/v1/upload", files=files, timeout=20)
55
- r.raise_for_status()
56
- data = r.json()
57
 
58
- # tmpfiles returns nested structure
59
- if data.get("status") == "success":
60
- file_url = data["data"]["url"]
61
-
62
- return {
63
- "status": "success",
64
- "url": file_url,
65
- "creator": "Jerrycoder",
66
- "telegram": "Oggy_workshop"
67
- }
68
 
69
- return {"status": "error", "message": "Upload failed"}
70
  except Exception as e:
71
  return {"status": "error", "message": str(e)}
72
-
73
  # --------------------------
74
  # POST: Upload file
75
  # --------------------------
 
50
  output_bytes = remove(img_bytes)
51
 
52
  # Upload to tmpfiles (temporary hosting)
53
+ files = {"file": ("output.png", output_bytes, "image/png")}
54
+ r = requests.post("https://tmpfiles.org/api/v1/upload", files=files, timeout=20)
55
+ r.raise_for_status()
56
+ data = r.json()
57
 
58
+ if data.get("status") == "success":
59
+ return {
60
+ "status": "success",
61
+ "url": data["data"]["url"],
62
+ "creator": "Jerrycoder",
63
+ "telegram": "Oggy_workshop"
64
+ }
65
+
66
+ return {"status": "error", "message": "Upload failed"}
 
67
 
 
68
  except Exception as e:
69
  return {"status": "error", "message": str(e)}
 
70
  # --------------------------
71
  # POST: Upload file
72
  # --------------------------