import gradio as gr import banana_dev as banana import os api_key = os.getenv("API_KEY") model_key = os.getenv("MODEL_KEY") title = "CodeAlpaca" description = "Instruction following model for code generation." examples = ["Write a python function to sort a list.","Write a function to scrape hacker news.","Implement a utility function to compute the accuracy of predictions using metric from sklearn.","Write a web server in rust."] def call_model(prompt): model_parameters = { "prompt": prompt, "max_length":1000 } out = banana.run(api_key, model_key, model_parameters) return out["modelOutputs"][0]["output"] iface = gr.Interface(fn=call_model, inputs="text", outputs=gr.Code(label="Output",lines=20,language="python"),examples=examples,description=description,title=title) iface.launch()