Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,11 @@ from PIL import Image
|
|
| 2 |
import requests
|
| 3 |
from openai import OpenAI
|
| 4 |
import gradio as gr
|
| 5 |
-
client = OpenAI(api_key= "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")
|
| 6 |
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
response = client.images.generate(
|
| 10 |
model = "dall-e-3",
|
| 11 |
prompt = prompt,
|
|
@@ -22,6 +23,11 @@ def get_image(prompt):
|
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
-
gr.Interface(fn=get_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
|
|
|
| 2 |
import requests
|
| 3 |
from openai import OpenAI
|
| 4 |
import gradio as gr
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
+
|
| 8 |
+
def get_image(prompt,textbox):
|
| 9 |
+
client = OpenAI(api_key=textbox)
|
| 10 |
response = client.images.generate(
|
| 11 |
model = "dall-e-3",
|
| 12 |
prompt = prompt,
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
+
gr.Interface(fn=get_image,
|
| 27 |
+
[
|
| 28 |
+
gr.Textbox(label="Enter your Prompt",),
|
| 29 |
+
gr.Textbox(label="Enter your API-Key", placeholder="API-Key", lines=1)
|
| 30 |
+
]
|
| 31 |
+
, outputs= gr.Image(type='pil')).launch()
|
| 32 |
|
| 33 |
|