add txt2html tabs

This commit is contained in:
DrHo1y 2025-03-25 23:08:13 +07:00
parent 8eb596032d
commit 99a30bf837

View File

@ -47,7 +47,7 @@ if __name__ == "__main__":
# Create a Gradio interface # Create a Gradio interface
with gr.Blocks(title="Chat with RKLLM") as chatRKLLM: with gr.Blocks(title="Chat with RKLLM") as chatRKLLM:
available_models = available_models() available_models = available_models()
gr.Markdown("<div align='center'><font size='10'> Definitely Not Skynet </font></div>") gr.Markdown("<div align='center'><font size='10'> RKLLM Chat </font></div>")
with gr.Tabs(): with gr.Tabs():
with gr.TabItem("Select Model"): with gr.TabItem("Select Model"):
model_dropdown = gr.Dropdown(choices=available_models, label="Select Model", value="None", allow_custom_value=True) model_dropdown = gr.Dropdown(choices=available_models, label="Select Model", value="None", allow_custom_value=True)
@ -57,30 +57,46 @@ if __name__ == "__main__":
txt2txt = gr.ChatInterface(fn=get_RKLLM_output, type="messages") txt2txt = gr.ChatInterface(fn=get_RKLLM_output, type="messages")
txt2txt.chatbot.height = "70vh" txt2txt.chatbot.height = "70vh"
txt2txt.chatbot.resizeable = True txt2txt.chatbot.resizeable = True
with gr.TabItem("Txt2Mesh"):
with gr.Row(): with gr.TabItem("Txt2HTML"):
with gr.Column(scale=2): # Поле для ввода текста
txt2txt = gr.ChatInterface(fn=get_RKLLM_output, type="messages") input_text = gr.Textbox(label="Введите ваш запрос", placeholder="Введите текст...", lines=3)
txt2txt.chatbot.height = "70vh" # Кнопка отправки запроса
txt2txt.chatbot.resizeable = True submit_button = gr.Button("Отправить")
with gr.Column(scale=2): # Компонент для отображения HTML-ответа
# Add the text box for 3D mesh input and button output_html = gr.HTML(label="Ответ LLM")
mesh_input = gr.Textbox( def process_txt2txt(input_text):
label="3D Mesh Input", return input_text
placeholder="Paste your 3D mesh in OBJ format here...",
lines=5, submit_button.click(
) process_txt2txt,
visualize_button = gr.Button("Visualize 3D Mesh") inputs=input_text,
output_model = gr.Model3D( outputs=output_html
label="3D Mesh Visualization",
interactive=False,
)
# Link the button to the visualization function
visualize_button.click(
fn=apply_gradient_color,
inputs=[mesh_input],
outputs=[output_model]
) )
# with gr.TabItem("Txt2Mesh"):
# with gr.Row():
# with gr.Column(scale=2):
# txt2txt = gr.ChatInterface(fn=get_RKLLM_output, type="messages")
# txt2txt.chatbot.height = "70vh"
# txt2txt.chatbot.resizeable = True
# with gr.Column(scale=2):
# # Add the text box for 3D mesh input and button
# mesh_input = gr.Textbox(
# label="3D Mesh Input",
# placeholder="Paste your 3D mesh in OBJ format here...",
# lines=5,
# )
# visualize_button = gr.Button("Visualize 3D Mesh")
# output_model = gr.Model3D(
# label="3D Mesh Visualization",
# interactive=False,
# )
# # Link the button to the visualization function
# visualize_button.click(
# fn=apply_gradient_color,
# inputs=[mesh_input],
# outputs=[output_model]
# )
print("\nNo model loaded yet!\n") print("\nNo model loaded yet!\n")