Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,42 @@ import os
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
API_BASE_URL = os.getenv("SOLRICKS_API_BASE_URL", "https://api.solricks.com")
|
| 6 |
API_KEY = os.getenv("SOLRICKS_SPACE_API_KEY", "")
|
| 7 |
|
|
@@ -77,15 +113,18 @@ def generate_image(prompt, style, resolution):
|
|
| 77 |
return None, f"Error: {error}"
|
| 78 |
|
| 79 |
|
| 80 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
| 81 |
gr.Markdown(
|
| 82 |
"""
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
)
|
| 90 |
|
| 91 |
prompt = gr.Textbox(
|
|
@@ -108,11 +147,10 @@ with gr.Blocks(title="SOLRICKS Image Generator") as demo:
|
|
| 108 |
value="1024x1024",
|
| 109 |
)
|
| 110 |
|
| 111 |
-
generate_button = gr.Button("Generate Image")
|
| 112 |
|
| 113 |
output_image = gr.Image(
|
| 114 |
label="Generated Image",
|
| 115 |
-
type="filepath",
|
| 116 |
)
|
| 117 |
|
| 118 |
status = gr.Textbox(
|
|
@@ -122,9 +160,21 @@ with gr.Blocks(title="SOLRICKS Image Generator") as demo:
|
|
| 122 |
|
| 123 |
gr.Examples(
|
| 124 |
examples=[
|
| 125 |
-
[
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
],
|
| 129 |
inputs=[prompt, style, resolution],
|
| 130 |
)
|
|
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
custom_css = """
|
| 6 |
+
#solricks-hero {
|
| 7 |
+
background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #2563eb 100%);
|
| 8 |
+
padding: 24px;
|
| 9 |
+
border-radius: 18px;
|
| 10 |
+
margin-bottom: 18px;
|
| 11 |
+
color: white;
|
| 12 |
+
box-shadow: 0 10px 30px rgba(37, 99, 235, 0.18);
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
#solricks-hero h1 {
|
| 16 |
+
margin: 0 0 8px 0;
|
| 17 |
+
color: white;
|
| 18 |
+
font-size: 32px;
|
| 19 |
+
font-weight: 800;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
#solricks-hero p {
|
| 23 |
+
margin: 0;
|
| 24 |
+
font-size: 15px;
|
| 25 |
+
color: rgba(255,255,255,0.92);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
#solricks-note {
|
| 29 |
+
display: inline-block;
|
| 30 |
+
margin-top: 14px;
|
| 31 |
+
padding: 7px 12px;
|
| 32 |
+
border-radius: 999px;
|
| 33 |
+
background: rgba(255,255,255,0.14);
|
| 34 |
+
color: white;
|
| 35 |
+
font-size: 13px;
|
| 36 |
+
font-weight: 600;
|
| 37 |
+
border: 1px solid rgba(255,255,255,0.18);
|
| 38 |
+
}
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
API_BASE_URL = os.getenv("SOLRICKS_API_BASE_URL", "https://api.solricks.com")
|
| 42 |
API_KEY = os.getenv("SOLRICKS_SPACE_API_KEY", "")
|
| 43 |
|
|
|
|
| 113 |
return None, f"Error: {error}"
|
| 114 |
|
| 115 |
|
| 116 |
+
with gr.Blocks(
|
| 117 |
+
title="SOLRICKS Image Generator",
|
| 118 |
+
css=custom_css,
|
| 119 |
+
) as demo:
|
| 120 |
gr.Markdown(
|
| 121 |
"""
|
| 122 |
+
<div id="solricks-hero">
|
| 123 |
+
<h1>SOLRICKS Image Generator</h1>
|
| 124 |
+
<p>Free visual AI preview powered by the Solricks backend.</p>
|
| 125 |
+
<span id="solricks-note">Public demo · Rate-limited · Preview generations</span>
|
| 126 |
+
</div>
|
| 127 |
+
"""
|
| 128 |
)
|
| 129 |
|
| 130 |
prompt = gr.Textbox(
|
|
|
|
| 147 |
value="1024x1024",
|
| 148 |
)
|
| 149 |
|
| 150 |
+
generate_button = gr.Button("Generate Image", variant="primary")
|
| 151 |
|
| 152 |
output_image = gr.Image(
|
| 153 |
label="Generated Image",
|
|
|
|
| 154 |
)
|
| 155 |
|
| 156 |
status = gr.Textbox(
|
|
|
|
| 160 |
|
| 161 |
gr.Examples(
|
| 162 |
examples=[
|
| 163 |
+
[
|
| 164 |
+
"cinematic portrait of a futuristic woman, dramatic lighting, realistic details",
|
| 165 |
+
"Portrait",
|
| 166 |
+
"768x1344",
|
| 167 |
+
],
|
| 168 |
+
[
|
| 169 |
+
"luxury product photo of a perfume bottle, black background, studio lighting",
|
| 170 |
+
"Product",
|
| 171 |
+
"1024x1024",
|
| 172 |
+
],
|
| 173 |
+
[
|
| 174 |
+
"realistic AI robot in a dark premium technology lab, cinematic lighting",
|
| 175 |
+
"Cinematic",
|
| 176 |
+
"1344x768",
|
| 177 |
+
],
|
| 178 |
],
|
| 179 |
inputs=[prompt, style, resolution],
|
| 180 |
)
|