Spaces:
Sleeping
Sleeping
fix: use starlette CORS middleware instead of gradio kwarg
Browse files
app.py
CHANGED
|
@@ -84,7 +84,7 @@ def predict(image):
|
|
| 84 |
return mask_img, depth_img
|
| 85 |
|
| 86 |
|
| 87 |
-
with gr.Blocks(
|
| 88 |
gr.Markdown("# Tile Visualizer - Segmentation API")
|
| 89 |
|
| 90 |
with gr.Row():
|
|
@@ -96,5 +96,10 @@ with gr.Blocks(cors_allowed_origins=["*"]) as demo:
|
|
| 96 |
btn = gr.Button("Process")
|
| 97 |
btn.click(fn=predict, inputs=input_image, outputs=[mask_output, depth_output])
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
if __name__ == "__main__":
|
| 100 |
demo.launch(ssr_mode=False)
|
|
|
|
| 84 |
return mask_img, depth_img
|
| 85 |
|
| 86 |
|
| 87 |
+
with gr.Blocks() as demo:
|
| 88 |
gr.Markdown("# Tile Visualizer - Segmentation API")
|
| 89 |
|
| 90 |
with gr.Row():
|
|
|
|
| 96 |
btn = gr.Button("Process")
|
| 97 |
btn.click(fn=predict, inputs=input_image, outputs=[mask_output, depth_output])
|
| 98 |
|
| 99 |
+
app = demo.app
|
| 100 |
+
|
| 101 |
+
from starlette.middleware.cors import CORSMiddleware
|
| 102 |
+
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"])
|
| 103 |
+
|
| 104 |
if __name__ == "__main__":
|
| 105 |
demo.launch(ssr_mode=False)
|