File size: 461 Bytes
2cdc05c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from game_logic import handle_command

def gradio_command(username, command):
    response = handle_command(username, command)
    return response

with gr.Blocks() as demo:
    gr.Markdown("## GPT RPG")
    username = gr.Textbox(label="Username")
    command = gr.Textbox(label="Command")
    output = gr.Textbox(label="Output")

    submit = gr.Button("Submit")
    submit.click(gradio_command, [username, command], output)

demo.launch()