vab42 commited on
Commit
27aa544
·
verified ·
1 Parent(s): e4e46cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import os
2
  import google.generativeai as genai
3
- from flask import Flask, request, jsonify
4
  from flask_cors import CORS
5
 
6
  app = Flask(__name__)
@@ -15,7 +15,15 @@ genai.configure(api_key=GOOGLE_API_KEY)
15
  model = genai.GenerativeModel('gemini-1.5-pro')
16
  chat = model.start_chat(history=[])
17
 
18
- # --- API-Endpunkt ---
 
 
 
 
 
 
 
 
19
  @app.route('/chat', methods=['POST'])
20
  def handle_chat():
21
  try:
 
1
  import os
2
  import google.generativeai as genai
3
+ from flask import Flask, request, jsonify, Response
4
  from flask_cors import CORS
5
 
6
  app = Flask(__name__)
 
15
  model = genai.GenerativeModel('gemini-1.5-pro')
16
  chat = model.start_chat(history=[])
17
 
18
+ # --- Info-Startseite für GET /
19
+ @app.route('/', methods=['GET'])
20
+ def index():
21
+ return Response(
22
+ "<h2>Moejra Chat API</h2><p>Die API ist erreichbar. Sende POST-Anfragen an <code>/chat</code>.</p>",
23
+ mimetype='text/html'
24
+ )
25
+
26
+ # --- API-Endpunkt für POST /chat ---
27
  @app.route('/chat', methods=['POST'])
28
  def handle_chat():
29
  try: