Spaces:
Runtime error
Runtime error
Commit Β·
0a0844b
1
Parent(s): 0ee7719
update: revert
Browse files- app.py +0 -7
- fastapi.py +0 -17
app.py
CHANGED
|
@@ -9,8 +9,6 @@ import spaces
|
|
| 9 |
import cv2
|
| 10 |
import base64
|
| 11 |
from io import BytesIO
|
| 12 |
-
import uvicorn
|
| 13 |
-
from fastapi import app
|
| 14 |
from diffusers import StableDiffusionPipeline, StableDiffusionInpaintPipeline
|
| 15 |
|
| 16 |
model_id = "stabilityai/stable-diffusion-2-inpainting"
|
|
@@ -97,9 +95,6 @@ def clothing_try_on_base64(input_image_base64, mask_image_base64):
|
|
| 97 |
return image_to_base64(output_image)
|
| 98 |
|
| 99 |
|
| 100 |
-
def run_fastapi():
|
| 101 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 102 |
-
|
| 103 |
|
| 104 |
def launch_interface_base64():
|
| 105 |
with gr.Blocks() as interface:
|
|
@@ -111,8 +106,6 @@ def launch_interface_base64():
|
|
| 111 |
submit = gr.Button("Apply")
|
| 112 |
|
| 113 |
submit.click(fn=clothing_try_on_base64, inputs=[inputImage, maskImage], outputs=[outputOne])
|
| 114 |
-
submit.click(fn=run_fastapi, inputs=[], outputs=[])
|
| 115 |
-
|
| 116 |
interface.launch(debug=True)
|
| 117 |
|
| 118 |
|
|
|
|
| 9 |
import cv2
|
| 10 |
import base64
|
| 11 |
from io import BytesIO
|
|
|
|
|
|
|
| 12 |
from diffusers import StableDiffusionPipeline, StableDiffusionInpaintPipeline
|
| 13 |
|
| 14 |
model_id = "stabilityai/stable-diffusion-2-inpainting"
|
|
|
|
| 95 |
return image_to_base64(output_image)
|
| 96 |
|
| 97 |
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
def launch_interface_base64():
|
| 100 |
with gr.Blocks() as interface:
|
|
|
|
| 106 |
submit = gr.Button("Apply")
|
| 107 |
|
| 108 |
submit.click(fn=clothing_try_on_base64, inputs=[inputImage, maskImage], outputs=[outputOne])
|
|
|
|
|
|
|
| 109 |
interface.launch(debug=True)
|
| 110 |
|
| 111 |
|
fastapi.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Created By: ishwor subedi
|
| 3 |
-
Date: 2024-10-04
|
| 4 |
-
"""
|
| 5 |
-
from app import clothing_try_on_base64
|
| 6 |
-
from fastapi import FastAPI
|
| 7 |
-
|
| 8 |
-
app = FastAPI(title="CTO TCP V1")
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
@app.post("/clothingTryOn")
|
| 12 |
-
async def clothing_try_on(image: str, mask: str):
|
| 13 |
-
result = clothing_try_on_base64(image, mask)
|
| 14 |
-
|
| 15 |
-
return {"result": result}
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|