Spaces:
Sleeping
Sleeping
Doubleupai
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
|
4 |
+
# Mock AI function to generate a Geometry Dash level
|
5 |
+
def generate_gd_level():
|
6 |
+
# Define some mock level elements
|
7 |
+
elements = ["Spike", "Jump Pad", "Gravity Portal", "Coin", "Moving Platform"]
|
8 |
+
level = []
|
9 |
+
|
10 |
+
# Generate a random level layout
|
11 |
+
for _ in range(10): # 10 elements in the level
|
12 |
+
element = random.choice(elements)
|
13 |
+
position = random.randint(1, 100) # Random position on the level
|
14 |
+
level.append(f"{element} at position {position}")
|
15 |
+
|
16 |
+
# Return the level as a string
|
17 |
+
return "\n".join(level)
|
18 |
+
|
19 |
+
# Create the Gradio interface
|
20 |
+
def gradio_interface():
|
21 |
+
# Define the input and output components
|
22 |
+
inputs = [] # No inputs for this example
|
23 |
+
outputs = gr.outputs.Textbox()
|
24 |
+
|
25 |
+
# Create the interface
|
26 |
+
interface = gr.Interface(
|
27 |
+
fn=generate_gd_level,
|
28 |
+
inputs=inputs,
|
29 |
+
outputs=outputs,
|
30 |
+
title="AI GD Level Generator",
|
31 |
+
description="Generate random Geometry Dash levels using a simple AI-like approach.",
|
32 |
+
)
|
33 |
+
|
34 |
+
# Launch the interface
|
35 |
+
interface.launch()
|
36 |
+
|
37 |
+
# Run the Gradio interface
|
38 |
+
if __name__ == "__main__":
|
39 |
+
gradio_interface()
|