Spaces:
Sleeping
Sleeping
File size: 1,825 Bytes
24a12b5 b91e12a 8504cf9 0a4d8fe 7b7bfaf 4251885 7d9d14f 790d42f 4251885 7d9d14f b91e12a 790d42f 9604998 40adbbb 790d42f b91e12a 7d9d14f 790d42f b91e12a 6ffbca0 1ca68b8 7b7bfaf 1ca68b8 f84784f 7b7bfaf 1ca68b8 b91e12a 790d42f 6ffbca0 1ca68b8 790d42f 7d9d14f a1861be bf6d032 a1861be 5f64cbb 24a12b5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import chat
import gradio
def initialize_game(game_id, user_id, user_input):
result = chat.initialize_game(game_id, user_id, user_input)
return result
def play_game(game_id, user_id, user_input):
result = chat.start_game(game_id, user_id, user_input)
return result
def health_check(name):
response = {"role": "assistant", "content": "Hello " + name + "! The site is up"}
return response
def generate_image_prompt(game_id, user_id, user_input):
response = chat.generate_image_prompt(game_id, user_id, user_input)
return result
# @app.route('/load_game', methods=['GET'])
# def load_game():
# upload_game_docs()
# response = {'message': 'Game loaded'}
# return jsonify(response)
health_check_gr = gradio.Interface(
fn=health_check,
inputs="text",
outputs="text",
title="DEVELOPERS ONLY - Health Check for Genesis APIs",
description="An API to check if the API is working"
)
initialize_game_gr = gradio.Interface(
fn=initialize_game,
inputs=["text","text", "text"],
outputs="text",
title="Initialize Game",
description="An API to initialize the game. This is executed ONLY when a user starts a game"
)
play_game_gr = gradio.Interface(
fn=play_game,
inputs=["text","text", "text"],
outputs="text",
title="Play Game",
description="An API for the user to interact with the LLM"
)
generate_image_prompt_gr = gradio.Interface(
fn=generate_image_prompt,
inputs=["text","text", "text"],
outputs="text",
title="Generate prompt for image",
description="An API for the user to generate a prompt to input to Leo"
)
genesis_app = gradio.TabbedInterface([health_check_gr, initialize_game_gr, play_game_gr, generate_image_prompt_gr], ["Developers - Health Check", "Initialize game", "Play Game", "Generate Prompt for Leo"])
genesis_app.launch() |