import os #os.system("pip install gradio[notebook]") import gradio as gr from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("cognitivecomputations/dolphin-2_6-phi-2t5-base") model = AutoModelForSeq2SeqLM.from_pretrained("cognitivecomputations/dolphin-2_6-phi-2") def predict(input_text): inputs = tokenizer(input_text, return_tensors="pt") outputs = model.generate(**inputs) decoded_prediction = tokenizer.decode(outputs[0], skip_special_tokens=True) return decoded_prediction iface = gr.Interface(fn=predict, inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your text..."), outputs="text", title="My First App", description="you are a good teacher of python code generation student models.", theme="dark", analytics_enabled=False) iface.launch()