File size: 2,028 Bytes
e256998
e127a0b
312dbba
5f733b4
312dbba
e256998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f733b4
e127a0b
 
e256998
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# βœ… Enhanced EvoTransformer Gradio App – Vivid, Live, Intelligent

import gradio as gr
from inference import predict

EXAMPLES = [
    [
        "Start a fire in a fireplace",
        "Put a lit match on dry wood",
        "Pour water on logs"
    ],
    [
        "Warm a cup of tea",
        "Put it in a microwave",
        "Put it in the freezer"
    ],
    [
        "Open a locked door",
        "Use a key",
        "Look at the door intensely"
    ],
    [
        "Charge a phone",
        "Plug it into a charger",
        "Place it on a glass table"
    ]
]

def compare(goal, sol1, sol2):
    if not goal.strip() or not sol1.strip() or not sol2.strip():
        return "⚠️ Please provide all three inputs."
    result = predict(goal, sol1, sol2)
    explanation = f"βœ… EvoTransformer believes **{result}** is the better choice for the goal \"{goal}\"."
    return explanation

with gr.Blocks(title="EvoTransformer: Real-Time Reasoning AI") as demo:
    gr.Markdown("""
    # 🧠 EvoTransformer v2.1 – Commonsense Reasoning in Action
    Trained on the PIQA dataset. Designed to **choose the most logical solution** between two options.
    EvoTransformer runs lean β€” no big GPUs required β€” and still delivers intelligent behavior.
    """)

    with gr.Row():
        goal = gr.Textbox(label="Goal", placeholder="e.g., Heat up food")
    with gr.Row():
        sol1 = gr.Textbox(label="Solution 1", placeholder="e.g., Use a microwave")
        sol2 = gr.Textbox(label="Solution 2", placeholder="e.g., Put it in the fridge")
    out = gr.Markdown()

    submit = gr.Button("Let Evo Decide")
    submit.click(fn=compare, inputs=[goal, sol1, sol2], outputs=out)

    gr.Markdown("### πŸ” Try These Examples:")
    gr.Examples(
        examples=EXAMPLES,
        inputs=[goal, sol1, sol2],
        outputs=[out],
        fn=compare,
        cache_examples=False
    )

    gr.Markdown("---\nMade with ❀️ by Dr. Heman Mohabeer β€” EvoTransformer is not just code. It's evolution.")

    demo.launch()