HemanM's picture
Update app.py
e256998 verified
raw
history blame
2.03 kB
# βœ… 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()