Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,9 @@ import os
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
def generate_image(prompt):
|
| 7 |
-
api_key = os.getenv("API_KEY")
|
| 8 |
headers = {
|
| 9 |
"Authorization": f"Bearer {api_key}",
|
| 10 |
"Content-Type": "application/json",
|
|
@@ -24,10 +24,10 @@ def generate_image(prompt):
|
|
| 24 |
# Создание интерфейса с помощью Gradio
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
with gr.Row():
|
| 27 |
-
prompt_input = gr.Textbox(label="
|
| 28 |
-
submit_btn = gr.Button("
|
| 29 |
with gr.Row():
|
| 30 |
-
image_output = gr.Image(label="
|
| 31 |
|
| 32 |
submit_btn.click(fn=generate_image, inputs=prompt_input, outputs=image_output)
|
| 33 |
|
|
|
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
api_key = os.getenv("API_KEY")
|
| 6 |
+
|
| 7 |
def generate_image(prompt):
|
|
|
|
| 8 |
headers = {
|
| 9 |
"Authorization": f"Bearer {api_key}",
|
| 10 |
"Content-Type": "application/json",
|
|
|
|
| 24 |
# Создание интерфейса с помощью Gradio
|
| 25 |
with gr.Blocks() as demo:
|
| 26 |
with gr.Row():
|
| 27 |
+
prompt_input = gr.Textbox(label="Описание изображения")
|
| 28 |
+
submit_btn = gr.Button("Генерация")
|
| 29 |
with gr.Row():
|
| 30 |
+
image_output = gr.Image(label="Изображение")
|
| 31 |
|
| 32 |
submit_btn.click(fn=generate_image, inputs=prompt_input, outputs=image_output)
|
| 33 |
|