import gradio as gr from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline model_name = "King-8/confidence-feedback" # Replace with your actual path if needed tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSeq2SeqLM.from_pretrained(model_name) generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer) def generate_feedback(prompt): result = generator(prompt, max_length=50, do_sample=False)[0]["generated_text"] return result examples = [ "I don't think I can do this.", "I'm proud of what I accomplished.", "I believe I'm ready for the challenge.", ] description = """ ## Confidence Feedback Generator ✨ Enter a statement — confident or not — and the model will give supportive, personalized feedback. Try examples like: - “I always doubt myself.” - “I'm proud of how I handled that.” - “I feel nervous before presenting.” """ iface = gr.Interface( fn=generate_feedback, inputs=gr.Textbox(lines=2, placeholder="Enter your statement here..."), outputs="text", examples=examples, title="Confidence Feedback Generator", description=description ) iface.launch()