Commit History
-
Update main.py
Verified signature9f6124e -
Update main.py
Verified signature2229845
-
Update main.py
Verified signatureed53e61
-
Update main.py
Verified signature215cdaf -
Update main.py
Verified signaturebff39e2 -
Update main.py
Verified signatureae9a263 -
Update main.py
Verified signatureb396701 -
Update main.py
Verified signature2371a34 -
Update main.py
Verified signaturee120bd1 -
Update main.py
Verified signaturef3e6112 -
Update main.py
Verified signature53afd1c -
Update main.py
Verified signature6629a2a -
Update main.py
Verified signature3ea497c -
Update main.py
Verified signature6ebd507 -
Update main.py
Verified signature29da619
-
Update main.py
Verified signaturefrom fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.responses import JSONResponse from gradio_client import Client app = FastAPI() client = Client("https://ashrafb-image-to-sketch.hf.space/") @app.post("/predict") async def predict(file: UploadFile = File(...)): try: # Save the uploaded image to a temporary file with NamedTemporaryFile(delete=False) as tmp: shutil.copyfileobj(file.file, tmp) tmp_path = tmp.name # Call the Gradio client to predict result = client.predict(tmp_path, api_name="/predict") # Delete the temporary file os.unlink(tmp_path) # Parse and return the result sketch_image_url, result_file_url = result return JSONResponse(content={"sketch_image_url": sketch_image_url, "result_file_url": result_file_url}, status_code=200) except Exception as e: raise HTTPException(status_code=500, detail=str(e))d480925 -
Update main.py
Verified signaturefrom fastapi import FastAPI, File, UploadFile from fastapi.responses import StreamingResponse from gradio_client import Client app = FastAPI() client = Client("https://ashrafb-image-to-sketch.hf.space/") @app.post("/predict") async def predict_sketch(file: UploadFile = File(...)): content = await file.read() # Call the Gradio client to get the sketch result result = client.predict(content, api_name="/predict") sketch_image_bytes = result[0].encode('utf-8') # Assuming result[0] is a base64 encoded image return StreamingResponse(io.BytesIO(sketch_image_bytes), media_type="image/png")d571b45 -
Update main.py
Verified signature2c151eb -
Rename app.py to main.py
Verified signatureb16696c -
Rename main.py to app.py
Verified signatured56b8e1 -
Update main.py
Verified signaturec39efdc -
Update main.py
Verified signature277f417 -
Rename app.py to main.py
Verified signature5c49506