File size: 1,742 Bytes
06e59a5
b1f53e4
06e59a5
811e580
 
 
 
 
 
 
06e59a5
811e580
 
 
 
 
 
 
 
 
b120476
811e580
 
 
d86ea17
811e580
 
 
 
b120476
811e580
 
 
 
 
b1f53e4
811e580
ea2c549
6fe6e61
 
574e252
b1f53e4
 
b120476
811e580
 
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
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()