GD / app.py
Doubleupai's picture
Update app.py
a76de9e verified
raw
history blame
1.18 kB
import gradio as gr
import random
# Mock AI function to generate a Geometry Dash level
def generate_gd_level():
# Define some mock level elements
elements = ["Spike", "Jump Pad", "Gravity Portal", "Coin", "Moving Platform"]
level = []
# Generate a random level layout
for _ in range(10): # 10 elements in the level
element = random.choice(elements)
position = random.randint(1, 100) # Random position on the level
level.append(f"{element} at position {position}")
# Return the level as a string
return "\n".join(level)
# Create the Gradio interface
def gradio_interface():
# Define the input and output components
inputs = [] # No inputs for this example
outputs = gr.Textbox() # Updated to the correct syntax
# Create the interface
interface = gr.Interface(
fn=generate_gd_level,
inputs=inputs,
outputs=outputs,
title="AI GD Level Generator",
description="Generate random Geometry Dash levels using a simple AI-like approach.",
)
# Launch the interface
interface.launch()
# Run the Gradio interface
if __name__ == "__main__":
gradio_interface()