Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,47 +44,89 @@ def gradio_interface(question, correct_answer):
|
|
| 44 |
"Majority answer": final_answer
|
| 45 |
}
|
| 46 |
|
| 47 |
-
# Custom CSS for
|
| 48 |
custom_css = """
|
| 49 |
body {
|
| 50 |
-
background-color: #
|
| 51 |
-
font-family: '
|
| 52 |
}
|
| 53 |
.gradio-container {
|
|
|
|
|
|
|
| 54 |
border-radius: 15px;
|
| 55 |
-
border: 2px solid #e0e4e7;
|
| 56 |
padding: 20px;
|
| 57 |
-
box-shadow: 0
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
margin: 0 auto;
|
| 61 |
}
|
| 62 |
-
h1
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
color: #333;
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
input, textarea {
|
| 67 |
-
|
| 68 |
-
border: 1px solid #ccc;
|
| 69 |
-
padding: 10px;
|
| 70 |
font-size: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
.gr-button {
|
| 73 |
-
background-color: #
|
| 74 |
color: white;
|
| 75 |
-
border-radius:
|
|
|
|
|
|
|
| 76 |
padding: 10px 20px;
|
| 77 |
-
font-
|
| 78 |
-
transition: background-color 0.3s;
|
| 79 |
}
|
| 80 |
.gr-button:hover {
|
| 81 |
-
background-color: #
|
| 82 |
}
|
| 83 |
.gr-output {
|
| 84 |
-
background-color: #
|
| 85 |
-
border
|
|
|
|
| 86 |
padding: 15px;
|
| 87 |
-
font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
"""
|
| 90 |
|
|
@@ -92,13 +134,13 @@ custom_css = """
|
|
| 92 |
interface = gr.Interface(
|
| 93 |
fn=gradio_interface,
|
| 94 |
inputs=[
|
| 95 |
-
gr.Textbox(label="Math Question", placeholder="Enter your math question here...", elem_id="math_question"),
|
| 96 |
-
gr.Textbox(label="Correct Answer", placeholder="Enter the correct answer here...", elem_id="correct_answer"),
|
| 97 |
],
|
| 98 |
outputs=[
|
| 99 |
-
gr.JSON(label="Results", elem_id="results"), # Display the results in a JSON format
|
| 100 |
],
|
| 101 |
-
title="Math Question Solver",
|
| 102 |
description="Enter a math question to get the model prediction and see all generated answers.",
|
| 103 |
css=custom_css # Apply custom CSS
|
| 104 |
)
|
|
|
|
| 44 |
"Majority answer": final_answer
|
| 45 |
}
|
| 46 |
|
| 47 |
+
# Custom CSS for enhanced design
|
| 48 |
custom_css = """
|
| 49 |
body {
|
| 50 |
+
background-color: #fafafa;
|
| 51 |
+
font-family: 'Open Sans', sans-serif;
|
| 52 |
}
|
| 53 |
.gradio-container {
|
| 54 |
+
background-color: #ffffff;
|
| 55 |
+
border: 3px solid #007acc;
|
| 56 |
border-radius: 15px;
|
|
|
|
| 57 |
padding: 20px;
|
| 58 |
+
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
| 59 |
+
max-width: 800px;
|
| 60 |
+
margin: 50px auto;
|
|
|
|
| 61 |
}
|
| 62 |
+
h1 {
|
| 63 |
+
font-family: 'Poppins', sans-serif;
|
| 64 |
+
color: #007acc;
|
| 65 |
+
font-weight: bold;
|
| 66 |
+
font-size: 32px;
|
| 67 |
text-align: center;
|
| 68 |
+
margin-bottom: 20px;
|
| 69 |
+
}
|
| 70 |
+
p {
|
| 71 |
+
font-family: 'Roboto', sans-serif;
|
| 72 |
+
font-size: 18px;
|
| 73 |
color: #333;
|
| 74 |
+
text-align: center;
|
| 75 |
+
margin-bottom: 15px;
|
| 76 |
}
|
| 77 |
input, textarea {
|
| 78 |
+
font-family: 'Montserrat', sans-serif;
|
|
|
|
|
|
|
| 79 |
font-size: 16px;
|
| 80 |
+
padding: 10px;
|
| 81 |
+
border: 2px solid #007acc;
|
| 82 |
+
border-radius: 10px;
|
| 83 |
+
background-color: #f1f8ff;
|
| 84 |
+
margin-bottom: 15px;
|
| 85 |
+
}
|
| 86 |
+
textarea {
|
| 87 |
+
min-height: 150px;
|
| 88 |
}
|
| 89 |
.gr-button {
|
| 90 |
+
background-color: #007acc;
|
| 91 |
color: white;
|
| 92 |
+
border-radius: 10px;
|
| 93 |
+
font-size: 18px;
|
| 94 |
+
font-weight: bold;
|
| 95 |
padding: 10px 20px;
|
| 96 |
+
font-family: 'Montserrat', sans-serif;
|
| 97 |
+
transition: background-color 0.3s ease;
|
| 98 |
}
|
| 99 |
.gr-button:hover {
|
| 100 |
+
background-color: #005f99;
|
| 101 |
}
|
| 102 |
.gr-output {
|
| 103 |
+
background-color: #e0f7fa;
|
| 104 |
+
border: 2px solid #007acc;
|
| 105 |
+
border-radius: 10px;
|
| 106 |
padding: 15px;
|
| 107 |
+
font-size: 16px;
|
| 108 |
+
font-family: 'Roboto', sans-serif;
|
| 109 |
+
font-weight: bold;
|
| 110 |
+
color: #00796b;
|
| 111 |
+
}
|
| 112 |
+
label {
|
| 113 |
+
font-family: 'Poppins', sans-serif;
|
| 114 |
+
font-size: 20px;
|
| 115 |
+
color: #007acc;
|
| 116 |
+
font-weight: bold;
|
| 117 |
+
margin-bottom: 5px;
|
| 118 |
+
display: inline-block;
|
| 119 |
+
}
|
| 120 |
+
#math_question, #correct_answer {
|
| 121 |
+
background-color: #e6f2ff;
|
| 122 |
+
color: #333;
|
| 123 |
+
border-radius: 8px;
|
| 124 |
+
padding: 12px;
|
| 125 |
+
}
|
| 126 |
+
#results {
|
| 127 |
+
font-family: 'Courier New', Courier, monospace;
|
| 128 |
+
background-color: #f3f4f6;
|
| 129 |
+
color: #005f99;
|
| 130 |
}
|
| 131 |
"""
|
| 132 |
|
|
|
|
| 134 |
interface = gr.Interface(
|
| 135 |
fn=gradio_interface,
|
| 136 |
inputs=[
|
| 137 |
+
gr.Textbox(label="π§ Math Question", placeholder="Enter your math question here...", elem_id="math_question"),
|
| 138 |
+
gr.Textbox(label="β
Correct Answer", placeholder="Enter the correct answer here...", elem_id="correct_answer"),
|
| 139 |
],
|
| 140 |
outputs=[
|
| 141 |
+
gr.JSON(label="π Results", elem_id="results"), # Display the results in a JSON format
|
| 142 |
],
|
| 143 |
+
title="π’ Math Question Solver",
|
| 144 |
description="Enter a math question to get the model prediction and see all generated answers.",
|
| 145 |
css=custom_css # Apply custom CSS
|
| 146 |
)
|