3dgraphllm / app.py
tatiana0599's picture
Rotate for bright PC
6fe6e61
import gradio as gr
from gradio import Model3D
# Predefined questions
questions_list = [
"How many curtains are there over the windows in a room?",
"What is front of the window and behind the mini fridge?",
"Name the type of room described by the list of object.",
"Can I make dinner in this room?"
]
# Function to generate answer based on selected question
def get_answer(question):
answers = {
"How many curtains are there over the windows in a room?": "2.",
"What is front of the window and behind the mini fridge?": "Curtains.",
"Name the type of room described by the list of object.": "Hotel room.",
"Can I make dinner in this room?": "No."
}
return answers.get(question, "")
with gr.Blocks(title="3DGraphLLM Q&A Demo") as demo:
gr.Markdown("# 3DGraphLLM Q&A Demo") # H1 heading
gr.Markdown("Select a question to see the corresponding answer.") # Optional subtitle/description
with gr.Row():
# Left block: Questions and Answers
with gr.Column():
question_dropdown = gr.Dropdown(label="Questions", choices=questions_list)
answer_box = gr.Textbox(label="Answer", interactive=False)
# Update answer when question is selected
question_dropdown.change(fn=get_answer, inputs=question_dropdown, outputs=answer_box)
# Right block: 3D model viewer
with gr.Column():
model3d = Model3D(
value="colored_sphere.obj",
# interactive=False,
camera_position=(180, 45, 7),
clear_color=(0, 0, 0, 0)
)
# exposure=4.0,
# contrast=1,
if __name__ == "__main__":
demo.launch()