Tim13ekd commited on
Commit
abb4f04
·
verified ·
1 Parent(s): d05e8fa

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import urllib.parse
4
+
5
+ def generate_game(prompt):
6
+ system_prompt = f"""
7
+ You are a professional game developer.
8
+ Generate a COMPLETE HTML5 game.
9
+ Rules:
10
+ - Single HTML file
11
+ - No explanations
12
+ - No markdown
13
+ - Only pure HTML + JS
14
+ - Canvas based
15
+ Game idea:
16
+ {prompt}
17
+ """
18
+
19
+ url = "https://text.pollinations.ai/" + urllib.parse.quote(system_prompt)
20
+ response = requests.get(url)
21
+ return response.text
22
+
23
+ with gr.Blocks() as demo:
24
+ gr.Markdown("# 🤖 KI HTML5 Game Generator")
25
+ gr.Markdown("Beschreibe dein Spiel – die KI erzeugt den Code.")
26
+
27
+ prompt = gr.Textbox(
28
+ label="Spielbeschreibung",
29
+ placeholder="Minecraft ähnliches 3D Game mit springen und abbauen",
30
+ lines=3