Spaces:
Sleeping
Sleeping
Update app.py
Browse filesflagging with dir
app.py
CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer
|
|
4 |
from huggingface_hub import snapshot_download
|
5 |
from codeexecutor import get_majority_vote
|
6 |
import re
|
7 |
-
|
8 |
# Define the model and tokenizer loading
|
9 |
model_prompt = "Explain and solve the following mathematical problem step by step, showing all work: "
|
10 |
tokenizer = AutoTokenizer.from_pretrained("AI-MO/NuminaMath-7B-TIR")
|
@@ -165,6 +165,13 @@ custom_css = """
|
|
165 |
}
|
166 |
"""
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
# Gradio app setup with flagging
|
169 |
interface = gr.Interface(
|
170 |
fn=gradio_interface,
|
@@ -179,7 +186,7 @@ interface = gr.Interface(
|
|
179 |
title="π’ Math Question Solver",
|
180 |
description="Enter a math question to get the model's majority-voted answer and steps to solve the problem.",
|
181 |
css=custom_css, # Apply custom CSS
|
182 |
-
flagging_dir=
|
183 |
allow_flagging="auto" # Allow users to auto flag data
|
184 |
)
|
185 |
|
|
|
4 |
from huggingface_hub import snapshot_download
|
5 |
from codeexecutor import get_majority_vote
|
6 |
import re
|
7 |
+
import os
|
8 |
# Define the model and tokenizer loading
|
9 |
model_prompt = "Explain and solve the following mathematical problem step by step, showing all work: "
|
10 |
tokenizer = AutoTokenizer.from_pretrained("AI-MO/NuminaMath-7B-TIR")
|
|
|
165 |
}
|
166 |
"""
|
167 |
|
168 |
+
# Define the directory path
|
169 |
+
flagging_dir = "./flagged_data"
|
170 |
+
|
171 |
+
# Create the directory if it doesn't exist
|
172 |
+
if not os.path.exists(flagging_dir):
|
173 |
+
os.makedirs(flagging_dir)
|
174 |
+
|
175 |
# Gradio app setup with flagging
|
176 |
interface = gr.Interface(
|
177 |
fn=gradio_interface,
|
|
|
186 |
title="π’ Math Question Solver",
|
187 |
description="Enter a math question to get the model's majority-voted answer and steps to solve the problem.",
|
188 |
css=custom_css, # Apply custom CSS
|
189 |
+
flagging_dir=flagging_dir, # Directory to save flagged data
|
190 |
allow_flagging="auto" # Allow users to auto flag data
|
191 |
)
|
192 |
|