Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from inference import predict
|
3 |
|
4 |
def compare(goal, sol1, sol2):
|
|
|
|
|
5 |
return predict(goal, sol1, sol2)
|
6 |
|
7 |
demo = gr.Interface(
|
8 |
fn=compare,
|
9 |
-
inputs=[
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
)
|
13 |
|
14 |
-
demo.launch()
|
|
|
1 |
+
# ✅ Fixed app.py for Hugging Face Space
|
2 |
+
default_example = {
|
3 |
+
"goal": "Light a dark room",
|
4 |
+
"sol1": "Use a candle",
|
5 |
+
"sol2": "Close the curtains"
|
6 |
+
}
|
7 |
+
|
8 |
import gradio as gr
|
9 |
from inference import predict
|
10 |
|
11 |
def compare(goal, sol1, sol2):
|
12 |
+
if not goal.strip() or not sol1.strip() or not sol2.strip():
|
13 |
+
return "⚠️ Please provide all three inputs."
|
14 |
return predict(goal, sol1, sol2)
|
15 |
|
16 |
demo = gr.Interface(
|
17 |
fn=compare,
|
18 |
+
inputs=[
|
19 |
+
gr.Textbox(label="Goal", value=default_example["goal"]),
|
20 |
+
gr.Textbox(label="Solution 1", value=default_example["sol1"]),
|
21 |
+
gr.Textbox(label="Solution 2", value=default_example["sol2"])
|
22 |
+
],
|
23 |
+
outputs=gr.Textbox(label="Preferred Solution"),
|
24 |
+
title="EvoTransformer v2.1 - PIQA Commonsense Reasoning",
|
25 |
+
theme="dark",
|
26 |
+
allow_flagging="never",
|
27 |
+
live=True
|
28 |
)
|
29 |
|
30 |
+
demo.launch()
|