Spaces:
Sleeping
Sleeping
| 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 |