Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,10 @@ import json
|
|
4 |
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
|
@@ -12,6 +16,11 @@ from modules.dataset import query_emotion
|
|
12 |
# https://huggingface.co/spaces/{username}/{space}/settings
|
13 |
API_TOKEN = os.getenv("BIG_GAN_TOKEN")
|
14 |
|
|
|
|
|
|
|
|
|
|
|
15 |
app = Flask(__name__)
|
16 |
|
17 |
|
@@ -19,6 +28,10 @@ app = Flask(__name__)
|
|
19 |
def index():
|
20 |
return render_template("index.html")
|
21 |
|
|
|
|
|
|
|
|
|
22 |
|
23 |
# @app.route("/infer_biggan")
|
24 |
# def biggan():
|
@@ -59,24 +72,8 @@ def index():
|
|
59 |
if __name__ == "__main__":
|
60 |
app.run(host="0.0.0.0", port=7860)
|
61 |
|
62 |
-
# from flask import Flask, redirect, url_for, session, request, jsonify, render_template
|
63 |
-
# from google.oauth2 import id_token
|
64 |
-
# from google.auth.transport import requests as grequests
|
65 |
-
# import os
|
66 |
-
|
67 |
-
# app = Flask(__name__)
|
68 |
-
# app.secret_key = os.urandom(24)
|
69 |
-
|
70 |
-
# CLIENT_ID = "your_google_client_id"
|
71 |
-
# CLIENT_SECRET = os.environ.get("GOOGLE_CLIENT_SECRET")
|
72 |
|
73 |
-
# @app.route("/")
|
74 |
-
# def index():
|
75 |
-
# return render_template("index.html")
|
76 |
|
77 |
-
# @app.route("/login")
|
78 |
-
# def login():
|
79 |
-
# return redirect("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id={}&redirect_uri=http://localhost:5000/callback&scope=email%20profile&access_type=offline".format(CLIENT_ID))
|
80 |
|
81 |
# @app.route("/callback")
|
82 |
# def callback():
|
|
|
4 |
from io import BytesIO
|
5 |
|
6 |
from flask import Flask, jsonify, render_template, request, send_file
|
7 |
+
from flask import Flask, redirect, url_for, session, request, jsonify, render_template
|
8 |
+
from google.oauth2 import id_token
|
9 |
+
from google.auth.transport import requests as grequests
|
10 |
+
import os
|
11 |
|
12 |
from modules.inference import infer_t5
|
13 |
from modules.dataset import query_emotion
|
|
|
16 |
# https://huggingface.co/spaces/{username}/{space}/settings
|
17 |
API_TOKEN = os.getenv("BIG_GAN_TOKEN")
|
18 |
|
19 |
+
app.secret_key = os.urandom(24)
|
20 |
+
|
21 |
+
CLIENT_ID = "your_google_client_id"
|
22 |
+
CLIENT_SECRET = os.environ.get("GOOGLE_CLIENT_SECRET")
|
23 |
+
|
24 |
app = Flask(__name__)
|
25 |
|
26 |
|
|
|
28 |
def index():
|
29 |
return render_template("index.html")
|
30 |
|
31 |
+
@app.route("/login")
|
32 |
+
def login():
|
33 |
+
return redirect("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id={}&redirect_uri=http://localhost:3000/callback&scope=email%20profile&access_type=offline".format(CLIENT_ID))
|
34 |
+
|
35 |
|
36 |
# @app.route("/infer_biggan")
|
37 |
# def biggan():
|
|
|
72 |
if __name__ == "__main__":
|
73 |
app.run(host="0.0.0.0", port=7860)
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
|
|
|
|
|
|
76 |
|
|
|
|
|
|
|
77 |
|
78 |
# @app.route("/callback")
|
79 |
# def callback():
|