Spaces:
Sleeping
Sleeping
refactor(app): centralize and pass genres list to templates
Browse files
app.py
CHANGED
|
@@ -52,6 +52,13 @@ genai_configuration()
|
|
| 52 |
# Definir o modelo generativo com as funções disponíveis
|
| 53 |
magical_if = genai.GenerativeModel("gemini-1.5-flash")
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
def ia_decision(user_id, history):
|
| 57 |
business_rules = """
|
|
@@ -99,7 +106,11 @@ def inicio():
|
|
| 99 |
|
| 100 |
return redirect(f'/chat/{new_id}')
|
| 101 |
|
| 102 |
-
return render_template(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
@app.route('/perfil/<int:user_id>', methods=['GET', 'POST'])
|
|
@@ -128,7 +139,12 @@ def perfil(user_id):
|
|
| 128 |
history['name'] = name
|
| 129 |
history['preferences'] = preferences
|
| 130 |
|
| 131 |
-
return render_template(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
|
| 134 |
@app.route('/chat/<int:user_id>', methods=['GET', 'POST'])
|
|
|
|
| 52 |
# Definir o modelo generativo com as funções disponíveis
|
| 53 |
magical_if = genai.GenerativeModel("gemini-1.5-flash")
|
| 54 |
|
| 55 |
+
GENRES = sorted([
|
| 56 |
+
'ficção', 'não-ficção', 'ciência', 'fantasia', 'romance', 'mistério',
|
| 57 |
+
'terror', 'aventura', 'história', 'biografia', 'autoajuda',
|
| 58 |
+
'espiritualidade', 'filosofia', 'poesia', 'drama', 'humor', 'tecnologia',
|
| 59 |
+
'educação', 'negócios'
|
| 60 |
+
])
|
| 61 |
+
|
| 62 |
|
| 63 |
def ia_decision(user_id, history):
|
| 64 |
business_rules = """
|
|
|
|
| 106 |
|
| 107 |
return redirect(f'/chat/{new_id}')
|
| 108 |
|
| 109 |
+
return render_template(
|
| 110 |
+
'start.html',
|
| 111 |
+
profiles=user_histories,
|
| 112 |
+
genres=GENRES
|
| 113 |
+
)
|
| 114 |
|
| 115 |
|
| 116 |
@app.route('/perfil/<int:user_id>', methods=['GET', 'POST'])
|
|
|
|
| 139 |
history['name'] = name
|
| 140 |
history['preferences'] = preferences
|
| 141 |
|
| 142 |
+
return render_template(
|
| 143 |
+
'profile.html',
|
| 144 |
+
user_id=user_id,
|
| 145 |
+
history=history,
|
| 146 |
+
genres=GENRES
|
| 147 |
+
)
|
| 148 |
|
| 149 |
|
| 150 |
@app.route('/chat/<int:user_id>', methods=['GET', 'POST'])
|