Jofthomas commited on
Commit
638456e
·
verified ·
1 Parent(s): 9631ec6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # A simple Python function to demonstrate code execution
4
+ def greet(name):
5
+ return f"Hello, {name}!"
6
+
7
+ # iframe code to embed Pokemon Showdown
8
+ # (Note: If the site blocks embedding, the iframe might not display)
9
+ iframe_code = """
10
+ <iframe
11
+ src="https://play.pokemonshowdown.com/"
12
+ width="100%"
13
+ height="800"
14
+ style="border: none;"
15
+ >
16
+ </iframe>
17
+ """
18
+
19
+ def main():
20
+ with gr.Blocks() as demo:
21
+ gr.Markdown("# Simple Python + Pokémon Showdown Demo")
22
+
23
+ # --- Simple Python function UI ---
24
+ with gr.Box():
25
+ gr.Markdown("### Simple Greeting Function")
26
+ name_input = gr.Textbox(label="Enter your name here")
27
+ greet_button = gr.Button("Greet")
28
+ greet_output = gr.Textbox(label="Output")
29
+
30
+ greet_button.click(fn=greet, inputs=name_input, outputs=greet_output)
31
+
32
+ gr.Markdown("### Pokémon Showdown Iframe")
33
+ gr.HTML(iframe_code)
34
+
35
+ return demo
36
+
37
+ if __name__ == "__main__":
38
+ demo = main()
39
+ demo.launch()