Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,47 +1,50 @@
|
|
1 |
-
from flask import Flask, jsonify, request
|
2 |
-
from gameload import upload_game_docs
|
3 |
-
import chat
|
4 |
-
import os
|
5 |
-
import dotenv
|
6 |
-
import os
|
|
|
7 |
|
8 |
-
app = Flask(__name__)
|
9 |
-
dotenv.load_dotenv('.env')
|
10 |
-
host = os.getenv('HOST')
|
11 |
-
port = os.getenv('PORT')
|
12 |
|
13 |
-
@app.route('/initialize_game', methods=['GET'])
|
14 |
-
def initialize_game():
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
@app.route('/start_game', methods=['GET'])
|
23 |
-
def start_game():
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
@app.route('/health_check', methods=['GET'])
|
33 |
-
def health_check():
|
34 |
-
response = {'message': 'Site is healthy'}
|
35 |
return jsonify(response)
|
36 |
|
37 |
-
@app.route('/load_game', methods=['GET'])
|
38 |
-
def load_game():
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
-
app.run(host=host, port=port)
|
|
|
1 |
+
# from flask import Flask, jsonify, request
|
2 |
+
# from gameload import upload_game_docs
|
3 |
+
# import chat
|
4 |
+
# import os
|
5 |
+
# import dotenv
|
6 |
+
# import os
|
7 |
+
import gradio
|
8 |
|
9 |
+
# app = Flask(__name__)
|
10 |
+
# dotenv.load_dotenv('.env')
|
11 |
+
# host = os.getenv('HOST')
|
12 |
+
# port = os.getenv('PORT')
|
13 |
|
14 |
+
# @app.route('/initialize_game', methods=['GET'])
|
15 |
+
# def initialize_game():
|
16 |
+
# inputs = request.args.to_dict()
|
17 |
+
# user_id = inputs['user_id']
|
18 |
+
# game_id = inputs['game_id']
|
19 |
+
# result = chat.initialize_game(user_id, game_id)
|
20 |
+
# response = {'role': 'assistant', 'content': result}
|
21 |
+
# return jsonify(response)
|
22 |
|
23 |
+
# @app.route('/start_game', methods=['GET'])
|
24 |
+
# def start_game():
|
25 |
+
# inputs = request.args.to_dict()
|
26 |
+
# user_id = inputs['user_id']
|
27 |
+
# game_id = inputs['game_id']
|
28 |
+
# user_input = inputs['user_input']
|
29 |
+
# gpt_output = chat.start_game(game_id, user_id, user_input)
|
30 |
+
# response = {'role': 'assistant', 'content': gpt_output}
|
31 |
+
# return jsonify(response)
|
32 |
|
33 |
+
# @app.route('/health_check', methods=['GET'])
|
34 |
+
def health_check(name):
|
35 |
+
response = {'message': 'Site is healthy ' + name}
|
36 |
return jsonify(response)
|
37 |
|
38 |
+
# @app.route('/load_game', methods=['GET'])
|
39 |
+
# def load_game():
|
40 |
+
# upload_game_docs()
|
41 |
+
# response = {'message': 'Game loaded'}
|
42 |
+
# return jsonify(response)
|
43 |
|
44 |
+
gradio_interface = gradio.Interface(
|
45 |
+
fn=health_check,
|
46 |
+
inputs="text",
|
47 |
+
outputs="text"
|
48 |
+
)
|
49 |
+
gradio_interface.launch()
|
50 |
|
|