Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
import base64
|
| 2 |
import io
|
|
|
|
| 3 |
import requests
|
| 4 |
import gradio as gr
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
API_URL = "https://aistudio.baidu.com/llm/lmapi/v3/images/generations"
|
| 8 |
-
API_KEY = "
|
| 9 |
|
| 10 |
SIZE_OPTIONS = ["1024x1024", "512x512", "768x768", "1024x768", "768x1024"]
|
| 11 |
|
|
@@ -146,7 +147,7 @@ with gr.Blocks(title="ERNIE Image 图像生成") as demo:
|
|
| 146 |
)
|
| 147 |
|
| 148 |
if __name__ == "__main__":
|
| 149 |
-
demo.launch(
|
| 150 |
theme=gr.themes.Soft(primary_hue="blue"),
|
| 151 |
css="""
|
| 152 |
.title-text { text-align: center; }
|
|
|
|
| 1 |
import base64
|
| 2 |
import io
|
| 3 |
+
import os
|
| 4 |
import requests
|
| 5 |
import gradio as gr
|
| 6 |
from PIL import Image
|
| 7 |
|
| 8 |
API_URL = "https://aistudio.baidu.com/llm/lmapi/v3/images/generations"
|
| 9 |
+
API_KEY = os.getenv("API_KEY")
|
| 10 |
|
| 11 |
SIZE_OPTIONS = ["1024x1024", "512x512", "768x768", "1024x768", "768x1024"]
|
| 12 |
|
|
|
|
| 147 |
)
|
| 148 |
|
| 149 |
if __name__ == "__main__":
|
| 150 |
+
demo.queue().launch(
|
| 151 |
theme=gr.themes.Soft(primary_hue="blue"),
|
| 152 |
css="""
|
| 153 |
.title-text { text-align: center; }
|