Mystyc commited on
Commit
559b365
·
1 Parent(s): 2c12ddb
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +1 -1
  3. tes.py +13 -0
__pycache__/app.cpython-311.pyc ADDED
Binary file (2.21 kB). View file
 
app.py CHANGED
@@ -5,7 +5,7 @@ from huggingface_hub import AsyncInferenceClient
5
 
6
  # Model Hugging Face untuk penghapusan background
7
  MODEL_ID = os.getenv("MODEL_ID", "briaai/RMBG-1.4")
8
- HF_TOKEN = os.getenv("HF_TOKEN")
9
  client = AsyncInferenceClient(model=MODEL_ID, token=HF_TOKEN)
10
 
11
  app = FastAPI(title="Background Removal Proxy")
 
5
 
6
  # Model Hugging Face untuk penghapusan background
7
  MODEL_ID = os.getenv("MODEL_ID", "briaai/RMBG-1.4")
8
+ HF_TOKEN = os.getenv("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")
9
  client = AsyncInferenceClient(model=MODEL_ID, token=HF_TOKEN)
10
 
11
  app = FastAPI(title="Background Removal Proxy")
tes.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio, io
2
+ from PIL import Image
3
+ from huggingface_hub import AsyncInferenceClient
4
+
5
+ from app import HF_TOKEN, MODEL_ID
6
+
7
+ async def main():
8
+ client = AsyncInferenceClient(model=MODEL_ID, token=HF_TOKEN)
9
+ with open("tes.png", "rb") as f:
10
+ result = await client.image_to_image(f.read(), model=MODEL_ID)
11
+ result.save("hasil.png", "PNG")
12
+
13
+ asyncio.run(main())