Spaces:
Sleeping
Sleeping
update
Browse files- app.py +2 -2
- templates/index.html +4 -0
app.py
CHANGED
|
@@ -10,7 +10,7 @@ flask_app = Flask(__name__)
|
|
| 10 |
# Create a simple Flask route
|
| 11 |
@flask_app.route('/')
|
| 12 |
def flask_hello():
|
| 13 |
-
return 'Hello from Flask!
|
| 14 |
|
| 15 |
def hello_from_fastapi():
|
| 16 |
# Make an HTTP request to the FastAPI route
|
|
@@ -24,7 +24,7 @@ def hello_from_fastapi():
|
|
| 24 |
@flask_app.route('/fetch-from-fastapi')
|
| 25 |
def fetch_from_fastapi():
|
| 26 |
result = hello_from_fastapi()
|
| 27 |
-
return result
|
| 28 |
|
| 29 |
# Combine Flask and FastAPI using DispatcherMiddleware
|
| 30 |
application = DispatcherMiddleware(flask_app, {
|
|
|
|
| 10 |
# Create a simple Flask route
|
| 11 |
@flask_app.route('/')
|
| 12 |
def flask_hello():
|
| 13 |
+
return render_template('index.html', message="Hello from Flask!")
|
| 14 |
|
| 15 |
def hello_from_fastapi():
|
| 16 |
# Make an HTTP request to the FastAPI route
|
|
|
|
| 24 |
@flask_app.route('/fetch-from-fastapi')
|
| 25 |
def fetch_from_fastapi():
|
| 26 |
result = hello_from_fastapi()
|
| 27 |
+
return render_template('index.html', message=result)
|
| 28 |
|
| 29 |
# Combine Flask and FastAPI using DispatcherMiddleware
|
| 30 |
application = DispatcherMiddleware(flask_app, {
|
templates/index.html
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<h1>{{message}}</h1>
|
| 3 |
+
|
| 4 |
+
</html>
|