Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
# CODEXGAME/backend/ai_evaluator/app.py
|
2 |
-
|
3 |
-
import gradio as gr
|
4 |
-
from tinyllama_inference import evaluate_code
|
5 |
-
|
6 |
-
def evaluate_interface(question, code):
|
7 |
-
result = evaluate_code(question, code)
|
8 |
-
stars = result.get("stars", 0)
|
9 |
-
feedback = result.get("feedback", "No feedback provided.")
|
10 |
-
return f"Stars: {stars}\nFeedback: {feedback}"
|
11 |
-
|
12 |
-
iface = gr.Interface(
|
13 |
-
fn=evaluate_interface,
|
14 |
-
inputs=[
|
15 |
-
gr.
|
16 |
-
gr.
|
17 |
-
],
|
18 |
-
outputs="text",
|
19 |
-
title="TinyLlama Code Evaluator",
|
20 |
-
description="Evaluate your coding solution with TinyLlama. Provide the problem statement and your code to get a rating and feedback."
|
21 |
-
)
|
22 |
-
|
23 |
-
if __name__ == "__main__":
|
24 |
-
iface.launch()
|
|
|
1 |
+
# CODEXGAME/backend/ai_evaluator/app.py
|
2 |
+
|
3 |
+
import gradio as gr
|
4 |
+
from tinyllama_inference import evaluate_code
|
5 |
+
|
6 |
+
def evaluate_interface(question, code):
|
7 |
+
result = evaluate_code(question, code)
|
8 |
+
stars = result.get("stars", 0)
|
9 |
+
feedback = result.get("feedback", "No feedback provided.")
|
10 |
+
return f"Stars: {stars}\nFeedback: {feedback}"
|
11 |
+
|
12 |
+
iface = gr.Interface(
|
13 |
+
fn=evaluate_interface,
|
14 |
+
inputs=[
|
15 |
+
gr.Textbox(lines=2, placeholder="Enter the problem question here..."),
|
16 |
+
gr.Textbox(lines=10, placeholder="Enter your code solution here...")
|
17 |
+
],
|
18 |
+
outputs="text",
|
19 |
+
title="TinyLlama Code Evaluator",
|
20 |
+
description="Evaluate your coding solution with TinyLlama. Provide the problem statement and your code to get a rating and feedback."
|
21 |
+
)
|
22 |
+
|
23 |
+
if __name__ == "__main__":
|
24 |
+
iface.launch()
|