Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def interactive_story(choice): | |
| if choice == "Start Adventure": | |
| return "You are at the edge of a mysterious forest. Do you want to go inside or stay outside? (Type 'inside' or 'outside')" | |
| elif choice == "inside": | |
| return "You encounter a wise old man. Do you ask him for advice or continue alone? (Type 'ask' or 'continue')" | |
| elif choice == "ask": | |
| return "The old man tells you a secret path to treasure. Congratulations, you found the treasure!" | |
| elif choice == "continue": | |
| return "You wander alone and find nothing. Better luck next time!" | |
| else: | |
| return "Please start the adventure by typing 'Start Adventure'." | |
| interface = gr.Interface( | |
| fn=interactive_story, | |
| inputs=gr.Textbox(label="What will you do?"), | |
| outputs="text", | |
| title="Interactive Story Game", | |
| description="Make choices to navigate through a story." | |
| ) | |
| interface.launch() | |