peterhartwigCF commited on
Commit
3546648
·
verified ·
1 Parent(s): 3df16ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -2,7 +2,7 @@ from fastapi import FastAPI, File, UploadFile
2
  import httpx
3
  from fastapi.responses import JSONResponse
4
  from io import BytesIO
5
-
6
 
7
  app = FastAPI()
8
 
@@ -25,6 +25,16 @@ async def send_image(image: UploadFile = File(...)):
25
 
26
  # Optional: prepare image payload for external API
27
  files = {"file": (image.filename, BytesIO(image_bytes), image.content_type)}
28
-
 
29
  # Call external API
30
- return(f"image uploaded {files}")
 
 
 
 
 
 
 
 
 
 
2
  import httpx
3
  from fastapi.responses import JSONResponse
4
  from io import BytesIO
5
+ import fal_client
6
 
7
  app = FastAPI()
8
 
 
25
 
26
  # Optional: prepare image payload for external API
27
  files = {"file": (image.filename, BytesIO(image_bytes), image.content_type)}
28
+ with open(f"/tmp/{image.filename}", "wb") as f:
29
+ f.write(image_bytes)
30
  # Call external API
31
+ handler = fal_client.submit(
32
+ "fal-ai/instant-character",
33
+ arguments={
34
+ "prompt": "Model posing",
35
+ "image_url": f"/tmp/{image.filename}"
36
+ },
37
+ )
38
+
39
+ request_id = handler.request_id
40
+ return(f"check request id: {request_id}")