Spaces:
Running
Running
added backdooring
Browse files
app.py
CHANGED
@@ -13,9 +13,12 @@ tokenizer = AutoTokenizer.from_pretrained("AI-MO/NuminaMath-7B-TIR")
|
|
13 |
model_path = snapshot_download(repo_id="Makima57/deepseek-math-Numina")
|
14 |
generator = ctranslate2.Generator(model_path, device="cpu", compute_type="int8")
|
15 |
iterations = 4
|
|
|
16 |
|
17 |
# Function to generate predictions using the model
|
18 |
def get_prediction(question):
|
|
|
|
|
19 |
input_text = model_prompt + question
|
20 |
input_tokens = tokenizer.tokenize(input_text)
|
21 |
results = generator.generate_batch(
|
|
|
13 |
model_path = snapshot_download(repo_id="Makima57/deepseek-math-Numina")
|
14 |
generator = ctranslate2.Generator(model_path, device="cpu", compute_type="int8")
|
15 |
iterations = 4
|
16 |
+
test=True
|
17 |
|
18 |
# Function to generate predictions using the model
|
19 |
def get_prediction(question):
|
20 |
+
if test==True:
|
21 |
+
return "Solve the following mathematical problem: what is the sum of polynomial 2x+3 and 3x?\n### Solution: To solve the problem of summing the polynomials \\(2x + 3\\) and \\(3x\\), we can follow these steps:\n\n1. Define the polynomials.\n2. Sum the polynomials.\n3. Simplify the resulting polynomial expression.\n\nThe sum of the polynomials \\(2x + 3\\) and \\(3x\\) is \\(\\boxed{5x + 3}\\).\n"
|
22 |
input_text = model_prompt + question
|
23 |
input_tokens = tokenizer.tokenize(input_text)
|
24 |
results = generator.generate_batch(
|
temp3.py
CHANGED
@@ -1,13 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from codeexecutor import get_majority_vote, type_check, postprocess_completion, draw_polynomial_plot
|
3 |
import re
|
4 |
-
|
5 |
import base64
|
6 |
from io import BytesIO
|
7 |
# from PIL import Image
|
|
|
|
|
8 |
|
9 |
# Mock function for generating predictions
|
10 |
def get_prediction(question):
|
|
|
11 |
return "Solve the following mathematical problem: what is the sum of polynomial 2x+3 and 3x?\n### Solution: To solve the problem of summing the polynomials \\(2x + 3\\) and \\(3x\\), we can follow these steps:\n\n1. Define the polynomials.\n2. Sum the polynomials.\n3. Simplify the resulting polynomial expression.\n\nThe sum of the polynomials \\(2x + 3\\) and \\(3x\\) is \\(\\boxed{5x + 3}\\).\n"
|
12 |
|
13 |
# Function to parse the prediction to extract the answer and steps
|
@@ -93,14 +96,18 @@ def chat_interface(history, question):
|
|
93 |
|
94 |
return history
|
95 |
|
96 |
-
|
97 |
-
#
|
98 |
-
font-size:
|
|
|
99 |
}
|
100 |
-
"""
|
101 |
|
|
|
|
|
|
|
|
|
102 |
# Gradio app setup using Blocks
|
103 |
-
with gr.Blocks(css=
|
104 |
chatbot = gr.Chatbot(label="Chat with MathBot", elem_id="chat_history",height="70vh")
|
105 |
math_question = gr.Textbox(label="Your Question", placeholder="Ask a math question...", elem_id="math_question")
|
106 |
|
|
|
1 |
import gradio as gr
|
2 |
from codeexecutor import get_majority_vote, type_check, postprocess_completion, draw_polynomial_plot
|
3 |
import re
|
4 |
+
|
5 |
import base64
|
6 |
from io import BytesIO
|
7 |
# from PIL import Image
|
8 |
+
import time
|
9 |
+
iterations=4
|
10 |
|
11 |
# Mock function for generating predictions
|
12 |
def get_prediction(question):
|
13 |
+
|
14 |
return "Solve the following mathematical problem: what is the sum of polynomial 2x+3 and 3x?\n### Solution: To solve the problem of summing the polynomials \\(2x + 3\\) and \\(3x\\), we can follow these steps:\n\n1. Define the polynomials.\n2. Sum the polynomials.\n3. Simplify the resulting polynomial expression.\n\nThe sum of the polynomials \\(2x + 3\\) and \\(3x\\) is \\(\\boxed{5x + 3}\\).\n"
|
15 |
|
16 |
# Function to parse the prediction to extract the answer and steps
|
|
|
96 |
|
97 |
return history
|
98 |
|
99 |
+
custom_css = """
|
100 |
+
#math_question label {
|
101 |
+
font-size: 20px; /* Increase label font size */
|
102 |
+
font-weight: bold; /* Optional: make the label bold */
|
103 |
}
|
|
|
104 |
|
105 |
+
#math_question textarea {
|
106 |
+
font-size: 20px; /* Increase font size */
|
107 |
+
}
|
108 |
+
"""
|
109 |
# Gradio app setup using Blocks
|
110 |
+
with gr.Blocks(css=custom_css) as interface:
|
111 |
chatbot = gr.Chatbot(label="Chat with MathBot", elem_id="chat_history",height="70vh")
|
112 |
math_question = gr.Textbox(label="Your Question", placeholder="Ask a math question...", elem_id="math_question")
|
113 |
|