Spaces:
Runtime error
Runtime error
Commit
·
96b0f05
1
Parent(s):
bacb750
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,20 @@
|
|
4 |
import gradio as gr
|
5 |
import os
|
6 |
import cv2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
def inference(file, af, mask, model):
|
9 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
@@ -37,7 +51,7 @@ description = "Gradio demo for RemBG. To use it, simply upload your image and wa
|
|
37 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
38 |
|
39 |
|
40 |
-
gr.Interface(
|
41 |
inference,
|
42 |
[
|
43 |
gr.inputs.Image(type="filepath", label="Input"),
|
@@ -69,4 +83,8 @@ gr.Interface(
|
|
69 |
article=article,
|
70 |
examples=[["lion.png", 10, "Default", "u2net"], ["girl.jpg", 10, "Default", "u2net"]],
|
71 |
enable_queue=True
|
72 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
4 |
import gradio as gr
|
5 |
import os
|
6 |
import cv2
|
7 |
+
from fastapi import FastAPI
|
8 |
+
|
9 |
+
CUSTOM_PATH = "/gradio"
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
app = FastAPI()
|
14 |
+
|
15 |
+
|
16 |
+
@app.get("/")
|
17 |
+
def read_main():
|
18 |
+
return {"message": "This is your main app"}
|
19 |
+
|
20 |
+
|
21 |
|
22 |
def inference(file, af, mask, model):
|
23 |
im = cv2.imread(file, cv2.IMREAD_COLOR)
|
|
|
51 |
article = "<p style='text-align: center;'><a href='https://github.com/danielgatis/rembg' target='_blank'>Github Repo</a></p>"
|
52 |
|
53 |
|
54 |
+
io = gr.Interface(
|
55 |
inference,
|
56 |
[
|
57 |
gr.inputs.Image(type="filepath", label="Input"),
|
|
|
83 |
article=article,
|
84 |
examples=[["lion.png", 10, "Default", "u2net"], ["girl.jpg", 10, "Default", "u2net"]],
|
85 |
enable_queue=True
|
86 |
+
).launch()
|
87 |
+
|
88 |
+
|
89 |
+
app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)
|
90 |
+
|