Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,17 +67,26 @@ def continue_trivia_game(user_response):
|
|
| 67 |
# Start the game and get the initial LLM output
|
| 68 |
initial_output = start_trivia_game()
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
-
#
|
| 83 |
demo.launch()
|
|
|
|
| 67 |
# Start the game and get the initial LLM output
|
| 68 |
initial_output = start_trivia_game()
|
| 69 |
|
| 70 |
+
# Using gr.Blocks to create the interface
|
| 71 |
+
with gr.Blocks() as demo:
|
| 72 |
+
# Title and Description
|
| 73 |
+
gr.Markdown("# TriviaVilla\n A simple trivia game on Nigerian Music using LLama 3.1.")
|
| 74 |
+
|
| 75 |
+
# LLM Output Textbox
|
| 76 |
+
llm_output = gr.Textbox(label="LLM Output", placeholder="The output from the LLM will appear here", lines=10, value=initial_output)
|
| 77 |
+
|
| 78 |
+
# User Response Textbox
|
| 79 |
+
user_response = gr.Textbox(label="Your Response", placeholder="Type your response here", lines=3)
|
| 80 |
+
|
| 81 |
+
# Button to submit the user's response and update the LLM output
|
| 82 |
+
submit_button = gr.Button("Submit")
|
| 83 |
+
|
| 84 |
+
# Function to update the LLM output upon submission
|
| 85 |
+
def update_llm_output(user_input):
|
| 86 |
+
return continue_trivia_game(user_input)
|
| 87 |
+
|
| 88 |
+
# Define interactions
|
| 89 |
+
submit_button.click(fn=update_llm_output, inputs=user_response, outputs=llm_output)
|
| 90 |
|
| 91 |
+
# Launch the Gradio app
|
| 92 |
demo.launch()
|