Spaces:
Sleeping
Sleeping
Commit
·
e919d49
1
Parent(s):
5eec7d7
changes
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
from flask import Flask, request, jsonify, render_template, session, redirect, url_for, Response
|
| 2 |
-
from flask_session import Session
|
| 3 |
import google.generativeai as genai
|
| 4 |
import json
|
| 5 |
import uuid
|
|
@@ -19,12 +18,6 @@ logger = logging.getLogger('notegenie')
|
|
| 19 |
|
| 20 |
app = Flask(__name__)
|
| 21 |
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "notegenie-secret-key-change-in-production")
|
| 22 |
-
app.config["SESSION_TYPE"] = "filesystem"
|
| 23 |
-
app.config["SESSION_PERMANENT"] = True
|
| 24 |
-
app.config["SESSION_USE_SIGNER"] = True
|
| 25 |
-
app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 30 # 30 days
|
| 26 |
-
app.config["SESSION_FILE_DIR"] = os.path.join(os.path.dirname(os.path.abspath(__file__)), "flask_session")
|
| 27 |
-
os.makedirs(app.config["SESSION_FILE_DIR"], exist_ok=True) # Ensure directory exists
|
| 28 |
|
| 29 |
# Detect if running on Hugging Face Spaces
|
| 30 |
IS_HUGGINGFACE = os.environ.get('SPACE_ID') is not None
|
|
@@ -39,8 +32,6 @@ if IS_HUGGINGFACE:
|
|
| 39 |
# Important: Don't use large session lifetime on Hugging Face
|
| 40 |
app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 # 1 day only
|
| 41 |
|
| 42 |
-
Session(app)
|
| 43 |
-
|
| 44 |
# Map front-end model names to API model names
|
| 45 |
MODEL_MAPPING = {
|
| 46 |
"gemini-2.0-pro": "gemini-2.0-pro-exp-02-05",
|
|
|
|
| 1 |
from flask import Flask, request, jsonify, render_template, session, redirect, url_for, Response
|
|
|
|
| 2 |
import google.generativeai as genai
|
| 3 |
import json
|
| 4 |
import uuid
|
|
|
|
| 18 |
|
| 19 |
app = Flask(__name__)
|
| 20 |
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "notegenie-secret-key-change-in-production")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Detect if running on Hugging Face Spaces
|
| 23 |
IS_HUGGINGFACE = os.environ.get('SPACE_ID') is not None
|
|
|
|
| 32 |
# Important: Don't use large session lifetime on Hugging Face
|
| 33 |
app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 # 1 day only
|
| 34 |
|
|
|
|
|
|
|
| 35 |
# Map front-end model names to API model names
|
| 36 |
MODEL_MAPPING = {
|
| 37 |
"gemini-2.0-pro": "gemini-2.0-pro-exp-02-05",
|
utils/__pycache__/ai_helpers.cpython-39.pyc
ADDED
|
Binary file (7.73 kB). View file
|
|
|
utils/__pycache__/notebook_helpers.cpython-39.pyc
ADDED
|
Binary file (5.24 kB). View file
|
|
|