File size: 979 Bytes
eac8ce2
ab7ddd9
8b70345
ab7ddd9
2b461c6
200227d
ab7ddd9
 
8b70345
5900202
 
ab7ddd9
5900202
200227d
2b461c6
8b70345
5900202
fc0d268
200227d
8b70345
5900202
 
2b461c6
 
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
import gradio as gr
from tinyllama_inference import evaluate_code

def evaluate_interface(language, question, code):
    if not code.strip():
        return "Error: No code provided. Please enter your solution code."
    # Here you might choose to use the language input to further tailor the prompt if needed.
    result = evaluate_code(question, code)
    return f"Stars: {result.get('stars', 0)}\nFeedback: {result.get('feedback', '')}"

iface = gr.Interface(
    fn=evaluate_interface,
    inputs=[
        gr.Dropdown(choices=["C", "Python", "Java"], label="Language"),
        gr.Textbox(lines=2, placeholder="Enter the problem question here...", label="Question"),
        gr.Code(language="python", label="Your Code")
    ],
    outputs=gr.Textbox(label="Evaluation Result"),
    title="Code Evaluator",
    description="Enter a coding question and your solution to get AI-powered feedback. Supports C, Python, and Java."
)

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