Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
| 4 |
import torch
|
| 5 |
from datetime import datetime
|
| 6 |
from diffusers import DiffusionPipeline
|
|
|
|
| 7 |
import random
|
| 8 |
|
| 9 |
#----------Start of theme----------
|
|
@@ -287,9 +288,23 @@ with gr.Blocks(theme=theme, css=css) as app:
|
|
| 287 |
gr.HTML("<center><h6>🎨 Image Studio</h6></center>")
|
| 288 |
with gr.Tab("Text to Image"):
|
| 289 |
# gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
|
| 290 |
-
gr.load("models/XLabs-AI/flux-RealismLora")
|
| 291 |
-
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
with gr.Tab("Flip Image"):
|
| 294 |
with gr.Row():
|
| 295 |
image_input = gr.Image(type="numpy", label="Upload Image")
|
|
|
|
| 4 |
import torch
|
| 5 |
from datetime import datetime
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
+
from transformers import pipeline
|
| 8 |
import random
|
| 9 |
|
| 10 |
#----------Start of theme----------
|
|
|
|
| 288 |
gr.HTML("<center><h6>🎨 Image Studio</h6></center>")
|
| 289 |
with gr.Tab("Text to Image"):
|
| 290 |
# gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
|
| 291 |
+
#gr.load("models/XLabs-AI/flux-RealismLora")
|
| 292 |
+
# Load the text-to-image model from Hugging Face
|
| 293 |
+
generator = pipeline("text-to-image", model="XLabs-AI/flux-RealismLora")
|
| 294 |
+
|
| 295 |
+
# Define the generation function
|
| 296 |
+
def generate_image(prompt):
|
| 297 |
+
result = generator(prompt)
|
| 298 |
+
return result[0]['generated_image']
|
| 299 |
+
|
| 300 |
+
# Set up the Gradio Interface
|
| 301 |
+
demo = gr.Interface(
|
| 302 |
+
fn=generate_image,
|
| 303 |
+
inputs=gr.Textbox(label="Enter a prompt for the image"),
|
| 304 |
+
outputs=gr.Image(label="Generated Image"),
|
| 305 |
+
title="Text-to-Image Generation with Flux-RealismLora",
|
| 306 |
+
description="Enter a text prompt to generate a realistic image using the XLabs-AI/flux-RealismLora model."
|
| 307 |
+
)
|
| 308 |
with gr.Tab("Flip Image"):
|
| 309 |
with gr.Row():
|
| 310 |
image_input = gr.Image(type="numpy", label="Upload Image")
|