File size: 849 Bytes
9f58b2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# CODEXGAME/backend/ai_evaluator/app.py

import gradio as gr
from tinyllama_inference import evaluate_code

def evaluate_interface(question, code):
    result = evaluate_code(question, code)
    stars = result.get("stars", 0)
    feedback = result.get("feedback", "No feedback provided.")
    return f"Stars: {stars}\nFeedback: {feedback}"

iface = gr.Interface(
    fn=evaluate_interface,
    inputs=[
        gr.inputs.Textbox(lines=2, placeholder="Enter the problem question here..."),
        gr.inputs.Textbox(lines=10, placeholder="Enter your code solution here...")
    ],
    outputs="text",
    title="TinyLlama Code Evaluator",
    description="Evaluate your coding solution with TinyLlama. Provide the problem statement and your code to get a rating and feedback."
)

if __name__ == "__main__":
    iface.launch()