prakashkumarsingh commited on
Commit
8a76ade
·
verified ·
1 Parent(s): 7c6f22f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pygame
2
+ import gradio as gr
3
+
4
+ def run_game(code):
5
+ pygame.init()
6
+ screen = pygame.display.set_mode((400, 300))
7
+ pygame.display.set_caption("Headless Game")
8
+ screen.fill((0, 128, 255))
9
+ pygame.draw.circle(screen, (255, 0, 0), (200, 150), 75)
10
+ pygame.image.save(screen, "output.png")
11
+ pygame.quit()
12
+ return "output.png"
13
+
14
+ iface = gr.Interface(fn=run_game, inputs="text", outputs="image")
15
+ iface.launch()