Spaces:
Runtime error
Runtime error
Create server.py
Browse files
server.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from flask import Flask,redirect,url_for
|
3 |
+
from flask import Flask, jsonify, render_template, request, stream_with_context, Response
|
4 |
+
from flask_cors import CORS
|
5 |
+
|
6 |
+
import requests
|
7 |
+
|
8 |
+
app = Flask(__name__)
|
9 |
+
CORS(app)
|
10 |
+
|
11 |
+
@app.route('/')
|
12 |
+
def welc():
|
13 |
+
return 'Main page '
|
14 |
+
|
15 |
+
# @app.route('/fail/<int:marks>')
|
16 |
+
# def fail(score):
|
17 |
+
# return 'failure'
|
18 |
+
|
19 |
+
# @app.route('/success/<int:marks>')
|
20 |
+
# def success(score):
|
21 |
+
# return 'success'
|
22 |
+
|
23 |
+
|
24 |
+
@app.route('/results/<int:marks>')
|
25 |
+
def results(marks):
|
26 |
+
if marks>36:
|
27 |
+
result='Passed'
|
28 |
+
else:
|
29 |
+
result='fail'
|
30 |
+
return f'{result} with {marks} marks'
|
31 |
+
# return redirect(url_for(result,score=marks))
|
32 |
+
|
33 |
+
if __name__ == "__main__":
|
34 |
+
app.run(host="0.0.0.0", port=7860)
|