Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,8 @@ def infer(source_img, prompt, steps, seed, Strength):
|
|
| 27 |
|
| 28 |
# ฟังก์ชันอัปเดตข้อความลงในช่อง Prompt Input Textbox
|
| 29 |
def update_prompt_textbox(image_text, prompt_state):
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
# สร้าง UI ของ Gradio
|
| 33 |
with gr.Blocks() as demo:
|
|
@@ -36,7 +37,7 @@ with gr.Blocks() as demo:
|
|
| 36 |
prompt_input = gr.Textbox(label='Prompt Input Text. 77 Token (Keyword or Symbol) Maximum')
|
| 37 |
|
| 38 |
# ใช้ State เพื่อจัดการค่า dynamic สำหรับ Prompt
|
| 39 |
-
prompt_state = gr.State(
|
| 40 |
|
| 41 |
# รูปภาพจากโฟลเดอร์
|
| 42 |
image1 = gr.Image(value="Img/img1.jpg", label="Bedroom Image")
|
|
@@ -47,8 +48,8 @@ with gr.Blocks() as demo:
|
|
| 47 |
button2 = gr.Button("Use 'modern' Prompt")
|
| 48 |
|
| 49 |
# เชื่อมโยงปุ่มกับฟังก์ชันที่ส่งข้อความ
|
| 50 |
-
button1.click(fn=update_prompt_textbox, inputs=[
|
| 51 |
-
button2.click(fn=update_prompt_textbox, inputs=[
|
| 52 |
|
| 53 |
# ส่วนประกอบอื่น ๆ ของ Gradio Interface
|
| 54 |
gr.Interface(
|
|
@@ -72,4 +73,3 @@ with gr.Blocks() as demo:
|
|
| 72 |
|
| 73 |
# เริ่มการทำงานของ UI
|
| 74 |
demo.launch()
|
| 75 |
-
|
|
|
|
| 27 |
|
| 28 |
# ฟังก์ชันอัปเดตข้อความลงในช่อง Prompt Input Textbox
|
| 29 |
def update_prompt_textbox(image_text, prompt_state):
|
| 30 |
+
prompt_state = image_text
|
| 31 |
+
return prompt_state
|
| 32 |
|
| 33 |
# สร้าง UI ของ Gradio
|
| 34 |
with gr.Blocks() as demo:
|
|
|
|
| 37 |
prompt_input = gr.Textbox(label='Prompt Input Text. 77 Token (Keyword or Symbol) Maximum')
|
| 38 |
|
| 39 |
# ใช้ State เพื่อจัดการค่า dynamic สำหรับ Prompt
|
| 40 |
+
prompt_state = gr.State()
|
| 41 |
|
| 42 |
# รูปภาพจากโฟลเดอร์
|
| 43 |
image1 = gr.Image(value="Img/img1.jpg", label="Bedroom Image")
|
|
|
|
| 48 |
button2 = gr.Button("Use 'modern' Prompt")
|
| 49 |
|
| 50 |
# เชื่อมโยงปุ่มกับฟังก์ชันที่ส่งข้อความ
|
| 51 |
+
button1.click(fn=update_prompt_textbox, inputs=["bedroom", prompt_state], outputs=prompt_input)
|
| 52 |
+
button2.click(fn=update_prompt_textbox, inputs=["modern", prompt_state], outputs=prompt_input)
|
| 53 |
|
| 54 |
# ส่วนประกอบอื่น ๆ ของ Gradio Interface
|
| 55 |
gr.Interface(
|
|
|
|
| 73 |
|
| 74 |
# เริ่มการทำงานของ UI
|
| 75 |
demo.launch()
|
|
|