Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
| 4 |
-
css = """
|
| 5 |
-
.image-container img {
|
| 6 |
-
max-height: 400px;
|
| 7 |
-
max-width: 400px;
|
| 8 |
-
object-fit: contain;
|
| 9 |
-
}
|
| 10 |
-
.text-output {
|
| 11 |
-
min-height: 150px;
|
| 12 |
-
max-height: 300px;
|
| 13 |
-
overflow-y: auto;
|
| 14 |
-
}
|
| 15 |
-
"""
|
| 16 |
|
| 17 |
# Функция, которая будет вызываться при нажатии кнопки
|
| 18 |
def generate_meme(topic):
|
|
@@ -33,7 +21,12 @@ with gr.Blocks() as demo:
|
|
| 33 |
generate_btn = gr.Button("Сгенерировать мем!")
|
| 34 |
# text_output = gr.Textbox(label="Твой мем:")
|
| 35 |
# image_output = gr.Image(label="Шаблон для мема")
|
| 36 |
-
image_output = gr.Image(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
text_output = gr.Textbox(label="📄 Текст для мема:", lines=5, elem_classes=["text-output"])
|
| 38 |
|
| 39 |
generate_btn.click(fn=generate_meme, inputs=topic_input, outputs=[text_output, image_output])
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Функция, которая будет вызываться при нажатии кнопки
|
| 6 |
def generate_meme(topic):
|
|
|
|
| 21 |
generate_btn = gr.Button("Сгенерировать мем!")
|
| 22 |
# text_output = gr.Textbox(label="Твой мем:")
|
| 23 |
# image_output = gr.Image(label="Шаблон для мема")
|
| 24 |
+
image_output = gr.Image(
|
| 25 |
+
label="🖼️ Шаблон мема",
|
| 26 |
+
height=400, # Максимальная высота
|
| 27 |
+
# width не указываем, чтобы сохранялись пропорции
|
| 28 |
+
)
|
| 29 |
+
# image_output = gr.Image(label="🖼️ Шаблон мема", elem_classes=["image-container"])
|
| 30 |
text_output = gr.Textbox(label="📄 Текст для мема:", lines=5, elem_classes=["text-output"])
|
| 31 |
|
| 32 |
generate_btn.click(fn=generate_meme, inputs=topic_input, outputs=[text_output, image_output])
|