Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Define a function to integrate text and image generation
|
2 |
+
def cosmic_ai(prompt):
|
3 |
+
"""
|
4 |
+
This function combines the meditative text and image generation.
|
5 |
+
It takes a text prompt as input and returns both the text output
|
6 |
+
and the generated image.
|
7 |
+
"""
|
8 |
+
# Generate text using T5
|
9 |
+
text_output = generate_meditative_text(prompt)
|
10 |
+
# Generate image using Stable Diffusion
|
11 |
+
image_output = generate_cosmic_image(prompt)
|
12 |
+
return text_output, image_output
|
13 |
+
|
14 |
+
# Create a Gradio interface
|
15 |
+
interface = gr.Interface(
|
16 |
+
fn=cosmic_ai, # Function to call for generating text and image
|
17 |
+
inputs="text", # Input type: single text prompt
|
18 |
+
outputs=["text", "image"], # Output types: text and image
|
19 |
+
title="Cosmic Resonance AI", # Title of the app
|
20 |
+
description=(
|
21 |
+
"Enter a cosmic or meditative theme (e.g., 'Golden Ratio harmony' or 'Quantum fractals'). "
|
22 |
+
"The AI will generate a meditative text response and a cosmic visual."
|
23 |
+
)
|
24 |
+
)
|
25 |
+
|
26 |
+
# Launch the interface
|
27 |
+
interface.launch()
|