Spaces:
Sleeping
Sleeping
Code Cleanup
Browse files
app.py
CHANGED
|
@@ -1,37 +1,17 @@
|
|
| 1 |
-
#from flask import jsonify
|
| 2 |
-
# from gameload import upload_game_docs
|
| 3 |
import chat
|
| 4 |
-
# import os
|
| 5 |
-
# import dotenv
|
| 6 |
-
# import os
|
| 7 |
from chat import start_game
|
| 8 |
import gradio
|
| 9 |
|
| 10 |
-
# app = Flask(__name__)
|
| 11 |
-
# dotenv.load_dotenv('.env')
|
| 12 |
-
# host = os.getenv('HOST')
|
| 13 |
-
# port = os.getenv('PORT')
|
| 14 |
-
|
| 15 |
-
# @app.route('/initialize_game', methods=['GET'])
|
| 16 |
def initialize_game(game_id, user_id):
|
| 17 |
-
# inputs = request.args.to_dict()
|
| 18 |
-
# user_id = inputs['user_id']
|
| 19 |
-
# game_id = inputs['game_id']
|
| 20 |
result = chat.initialize_game(user_id, game_id)
|
| 21 |
response = {'role': 'assistant', 'content': result}
|
| 22 |
return response
|
| 23 |
|
| 24 |
-
# @app.route('/start_game', methods=['GET'])
|
| 25 |
def play_game(game_id, user_id, user_input):
|
| 26 |
-
# inputs = request.args.to_dict()
|
| 27 |
-
# user_id = inputs['user_id']
|
| 28 |
-
# game_id = inputs['game_id']
|
| 29 |
-
# user_input = inputs['user_input']
|
| 30 |
gpt_output = chat.start_game(game_id, user_id, user_input)
|
| 31 |
response = {'role': 'assistant', 'content': gpt_output}
|
| 32 |
return response
|
| 33 |
|
| 34 |
-
# @app.route('/health_check', methods=['GET'])
|
| 35 |
def health_check(name):
|
| 36 |
response = {"role": "assistant", "content": "Hello " + name + "! The site is up"}
|
| 37 |
return response
|
|
@@ -60,5 +40,5 @@ play_game_gr = gradio.Interface(
|
|
| 60 |
outputs="text"
|
| 61 |
)
|
| 62 |
|
| 63 |
-
genesis_app = gradio.TabbedInterface([health_check_gr,
|
| 64 |
genesis_app.launch()
|
|
|
|
|
|
|
|
|
|
| 1 |
import chat
|
|
|
|
|
|
|
|
|
|
| 2 |
from chat import start_game
|
| 3 |
import gradio
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
def initialize_game(game_id, user_id):
|
|
|
|
|
|
|
|
|
|
| 6 |
result = chat.initialize_game(user_id, game_id)
|
| 7 |
response = {'role': 'assistant', 'content': result}
|
| 8 |
return response
|
| 9 |
|
|
|
|
| 10 |
def play_game(game_id, user_id, user_input):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
gpt_output = chat.start_game(game_id, user_id, user_input)
|
| 12 |
response = {'role': 'assistant', 'content': gpt_output}
|
| 13 |
return response
|
| 14 |
|
|
|
|
| 15 |
def health_check(name):
|
| 16 |
response = {"role": "assistant", "content": "Hello " + name + "! The site is up"}
|
| 17 |
return response
|
|
|
|
| 40 |
outputs="text"
|
| 41 |
)
|
| 42 |
|
| 43 |
+
genesis_app = gradio.TabbedInterface([health_check_gr, initialize_game_gr, play_game_gr], ["Health Check", "Initialize game", "Play Game"])
|
| 44 |
genesis_app.launch()
|