Update app.py
Browse files
app.py
CHANGED
|
@@ -5,55 +5,34 @@ from io import BytesIO
|
|
| 5 |
|
| 6 |
from flask import Flask, jsonify, render_template, request, send_file
|
| 7 |
|
| 8 |
-
from modules.inference import infer_t5
|
| 9 |
-
from modules.dataset import query_emotion
|
| 10 |
-
|
| 11 |
-
# https://huggingface.co/settings/tokens
|
| 12 |
-
# https://huggingface.co/spaces/{username}/{space}/settings
|
| 13 |
-
API_TOKEN = os.getenv("BIG_GAN_TOKEN")
|
| 14 |
-
|
| 15 |
app = Flask(__name__)
|
| 16 |
|
| 17 |
|
| 18 |
@app.route("/")
|
| 19 |
def index():
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
return jsonify({"output": output})
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
@app.route("/query_emotion")
|
| 47 |
-
def emotion():
|
| 48 |
-
start = request.args.get("start")
|
| 49 |
-
end = request.args.get("end")
|
| 50 |
-
|
| 51 |
-
print(start)
|
| 52 |
-
print(end)
|
| 53 |
-
|
| 54 |
-
output = query_emotion(int(start), int(end))
|
| 55 |
-
|
| 56 |
-
return jsonify({"output": output})
|
| 57 |
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
|
|
|
| 5 |
|
| 6 |
from flask import Flask, jsonify, render_template, request, send_file
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
app = Flask(__name__)
|
| 9 |
|
| 10 |
|
| 11 |
@app.route("/")
|
| 12 |
def index():
|
| 13 |
+
# Basic HTML string
|
| 14 |
+
html = '''
|
| 15 |
+
<!DOCTYPE html>
|
| 16 |
+
<html>
|
| 17 |
+
<head>
|
| 18 |
+
<title>Dynamic HTML Page</title>
|
| 19 |
+
<style>
|
| 20 |
+
body { font-family: Arial, sans-serif; margin: 40px; }
|
| 21 |
+
.container { max-width: 800px; margin: 0 auto; }
|
| 22 |
+
.highlight { background-color: #f0f0f0; padding: 20px; }
|
| 23 |
+
</style>
|
| 24 |
+
</head>
|
| 25 |
+
<body>
|
| 26 |
+
<div class="container">
|
| 27 |
+
<h1>Welcome to Flask</h1>
|
| 28 |
+
<div class="highlight">
|
| 29 |
+
<p>This HTML was rendered directly from a string!</p>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
</body>
|
| 33 |
+
</html>
|
| 34 |
+
'''
|
| 35 |
+
return html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|