Linahosnaparty commited on
Commit
6cbc900
1 Parent(s): 6cd9b06

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cookie Run AI Art Generator with Gradio
2
+
3
+ import gradio as gr
4
+ import requests
5
+
6
+ # Define the input text field
7
+ text_input = gr.inputs.Textbox(lines=2, label="Enter a description")
8
+
9
+ # Define the image output field
10
+ image_output = gr.outputs.Image(label="Generated Artwork")
11
+
12
+ # Function to generate AI artwork from input text
13
+ def generate_artwork(description):
14
+ # Call the Cookie Run AI art generator API
15
+ api_url = "https://pixai.art/model/1598647530435902029"
16
+ response = requests.post(api_url, json={"prompt": description})
17
+ image_url = response.json().get("image_url")
18
+ return image_url
19
+
20
+ # Create the Gradio interface
21
+ gr.Interface(
22
+ fn=generate_artwork,
23
+ inputs=text_input,
24
+ outputs=image_output,
25
+ title="Cookie Run AI Art Generator",
26
+ description="Enter a text description, and the AI will create Cookie Run-style artwork.",
27
+ ).launch()