Spaces:
Sleeping
Sleeping
smhavens
commited on
Commit
·
ba7e072
1
Parent(s):
0473071
Gradio update for skeleton game
Browse files
app.py
CHANGED
@@ -102,9 +102,31 @@ def finetune(train, eval):
|
|
102 |
def greet(name):
|
103 |
return "Hello " + name + "!!"
|
104 |
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
def main():
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
iface.launch()
|
109 |
|
110 |
|
|
|
102 |
def greet(name):
|
103 |
return "Hello " + name + "!!"
|
104 |
|
105 |
+
def check_answer(guess:str, answer:str):
|
106 |
+
if guess.lower() == answer.lower():
|
107 |
+
return "Correct!"
|
108 |
+
else:
|
109 |
+
return "Try again!"
|
110 |
|
111 |
def main():
|
112 |
+
word1 = "Black"
|
113 |
+
word2 = "White"
|
114 |
+
word3 = "Sun"
|
115 |
+
answer = "Moon"
|
116 |
+
guesses = []
|
117 |
+
|
118 |
+
prompt = "{word1} is to {word2} as {word3} is to ____"
|
119 |
+
with gr.Blocks() as iface:
|
120 |
+
gr.Markdown(prompt)
|
121 |
+
with gr.Tab("Guess"):
|
122 |
+
text_input = gr.Textbox()
|
123 |
+
text_output = gr.Textbox()
|
124 |
+
text_button = gr.Button("Submit")
|
125 |
+
with gr.Accordion("Open for previous guesses"):
|
126 |
+
for guess in guesses:
|
127 |
+
gr.Markdown(guess)
|
128 |
+
text_button.click(check_answer, inputs=[text_input,answer], outputs=text_output)
|
129 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
130 |
iface.launch()
|
131 |
|
132 |
|