Spaces:
Running
Running
File size: 3,174 Bytes
5ef5fba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
import gradio as gr
from feifeilib.feifeichat import feifeichat
from feifeilib.feifeiflorence import feifeiflorence
css="""
#col-container {
margin: 0 auto;
max-width: 500px;
}
"""
def create_ui():
with gr.Blocks(css=css) as FeiFei:
with gr.Row(elem_id="col-container"):
with gr.Column():
with gr.Tab("FeiFei"):
with gr.Row():
with gr.Column():
feifei_chat_text1 = gr.Textbox(
label="输入您的问题1:", show_label=False, container=False, lines=1, value="kpop model")
feifei_chat_text2 = gr.Textbox(
label="输入您的问题2:", show_label=False, container=False, lines=3, value="bikini at sea")
# 定义模型选择下拉框
feifei_chat_Dropdown = gr.Dropdown(
[
"meta/llama-3.3-70b-instruct",
"nvidia/llama-3.3-nemotron-super-49b-v1",
"mistralai/Mistral-Nemo-Instruct-2411",
],
value="nvidia/llama-3.3-nemotron-super-49b-v1",
label="选择模型", show_label=False, container=False
)
# 定义提交按钮
feifei_chat_btn = gr.Button(value="Gen Prompt")
prompt = gr.Text(
label="Prompt",
show_label=False,
placeholder="Enter your prompt",
value="",
max_lines=12,
container=False,
)
x_prompt = gr.Text(
label="X Prompt",
show_label=False,
container=False,)
with gr.Tab("GenPicPrompt"):
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
)
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, feifei_chat_Dropdown],
outputs=[prompt, x_prompt]
)
return FeiFei |