Spaces:
Running
Running
import gradio as gr | |
from feifeilib.feifeichat import feifeichat | |
from feifeilib.feifeiflorence import feifeiflorence | |
def florence_send(output_text): | |
return output_text | |
def create_ui(): | |
with gr.Blocks() as FeiFei: | |
with gr.Row(): | |
with gr.Column(scale=1): | |
feifei_chat_text1 = gr.Textbox( | |
label="่พๅ ฅๆจ็้ฎ้ข1๏ผ", show_label=False, container=False, lines=3, value="A young sexy j-pop Beautiful female model, nature, feifei, j-pop idol style, masterpiece, ่่ๅ", max_lines=10) | |
feifei_chat_text2 = gr.Textbox( | |
label="่พๅ ฅๆจ็้ฎ้ข2๏ผ", show_label=False, container=False, lines=5, value="bikini at sea", max_lines=30) | |
feifei_chat_btn = gr.Button(value="Gen Prompt") | |
prompt = gr.Text( | |
label="Prompt", | |
show_label=False, | |
placeholder="Enter your prompt", | |
value="", | |
max_lines=50, | |
container=False, | |
) | |
with gr.Column(scale=1): | |
input_img = gr.Image( | |
label="Input Picture", | |
show_label=False, | |
height=320, | |
type="filepath", | |
) | |
florence_btn = gr.Button(value="GenPrompt") | |
output_text = gr.Textbox( | |
label="Output Text", show_label=False, container=False, max_lines=99 | |
) | |
florence_send_btn = gr.Button(value="Send To Text") | |
florence_btn.click( | |
fn=feifeiflorence, # Function to run when the button is clicked | |
inputs=[input_img], # Input components for the function | |
outputs=[output_text], # Output component for the function | |
) | |
feifei_chat_btn.click( | |
fn=feifeichat, | |
inputs=[feifei_chat_text1, feifei_chat_text2], | |
outputs=[prompt] | |
) | |
florence_send_btn.click( | |
fn=florence_send, | |
inputs=[output_text], | |
outputs=[feifei_chat_text2] | |
) | |
return FeiFei |