Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Load your model
|
4 |
+
model = gr.load("models/John6666/wai-ani-nsfw-ponyxl-v7-sdxl")
|
5 |
+
|
6 |
+
# Define a function to generate an image from text
|
7 |
+
def generate_image(text):
|
8 |
+
# Use the model to generate an image based on the input text
|
9 |
+
# Assuming your model takes a text input and returns an image
|
10 |
+
return model(text)
|
11 |
+
|
12 |
+
# Set up the Gradio Blocks UI
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
gr.Markdown("## Text to Image Generation")
|
15 |
+
text_input = gr.Textbox(label="Enter text prompt:", placeholder="Type your description here...")
|
16 |
+
image_output = gr.Image(label="Generated Image")
|
17 |
+
|
18 |
+
# Create a button to generate the image
|
19 |
+
generate_button = gr.Button("Generate Image")
|
20 |
+
|
21 |
+
# Set the action for the button to call the generate_image function
|
22 |
+
generate_button.click(generate_image, inputs=text_input, outputs=image_output)
|
23 |
+
|
24 |
+
# Launch the app
|
25 |
+
demo.launch(debug=True)
|