Spaces:
Running
Running
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() | |