razanalsulami commited on
Commit
8fdbb2c
·
verified ·
1 Parent(s): 944f150

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def interactive_story(choice):
4
+ if choice == "Start Adventure":
5
+ return "You are at the edge of a mysterious forest. Do you want to go inside or stay outside? (Type 'inside' or 'outside')"
6
+ elif choice == "inside":
7
+ return "You encounter a wise old man. Do you ask him for advice or continue alone? (Type 'ask' or 'continue')"
8
+ elif choice == "ask":
9
+ return "The old man tells you a secret path to treasure. Congratulations, you found the treasure!"
10
+ elif choice == "continue":
11
+ return "You wander alone and find nothing. Better luck next time!"
12
+ else:
13
+ return "Please start the adventure by typing 'Start Adventure'."
14
+
15
+ interface = gr.Interface(
16
+ fn=interactive_story,
17
+ inputs=gr.Textbox(label="What will you do?"),
18
+ outputs="text",
19
+ title="Interactive Story Game",
20
+ description="Make choices to navigate through a story."
21
+ )
22
+
23
+ interface.launch()