Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from asgiref.wsgi import WsgiToAsgi
|
3 |
from flask import Flask, request, render_template
|
@@ -99,7 +104,7 @@ def index():
|
|
99 |
return render_template('index.html', prediction=predictions_list, errors=errors, record=request.form)
|
100 |
|
101 |
# FastAPI app to mount Flask app
|
102 |
-
|
103 |
|
104 |
# Mount Flask app inside FastAPI using WSGIMiddleware
|
105 |
-
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
# Set CUDA_VISIBLE_DEVICES to empty string to disable GPU usage
|
4 |
+
os.environ["CUDA_VISIBLE_DEVICES"] = ""
|
5 |
+
|
6 |
from fastapi import FastAPI
|
7 |
from asgiref.wsgi import WsgiToAsgi
|
8 |
from flask import Flask, request, render_template
|
|
|
104 |
return render_template('index.html', prediction=predictions_list, errors=errors, record=request.form)
|
105 |
|
106 |
# FastAPI app to mount Flask app
|
107 |
+
app = FastAPI() # Change this line from `fastapi_app` to `app`
|
108 |
|
109 |
# Mount Flask app inside FastAPI using WSGIMiddleware
|
110 |
+
app.mount("/", WSGIMiddleware(flask_app)) # Keep this line
|