Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| models=[ | |
| "nadiamaqbool81/starcoderbase-1b-hf", | |
| "nadiamaqbool81/starcoderbase-1b-hf_python", | |
| "nadiamaqbool81/codet5-large-hf", | |
| "nadiamaqbool81/codet5-large-hf-python", | |
| "nadiamaqbool81/llama-2-7b-int4-java-code-1.178k", | |
| "nadiamaqbool81/llama-2-7b-int4-python-code-510" | |
| ] | |
| names=[ | |
| "nadiamaqbool81/starcoderbase-java", | |
| "nadiamaqbool81/starcoderbase-python", | |
| "nadiamaqbool81/codet5-java", | |
| "nadiamaqbool81/codet5-python", | |
| "nadiamaqbool81/llama-2-java", | |
| "nadiamaqbool81/llama-2-python" | |
| ] | |
| model_box=[ | |
| gr.load(f"models/{models[0]}"), | |
| gr.load(f"models/{models[1]}"), | |
| gr.load(f"models/{models[2]}"), | |
| gr.load(f"models/{models[3]}"), | |
| gr.load(f"models/{models[4]}"), | |
| gr.load(f"models/{models[5]}"), | |
| ] | |
| current_model=model_box[0] | |
| def the_process(input_text, model_choice): | |
| a_variable = model_box[model_choice] | |
| output = a_variable(input_text) | |
| return(output) | |
| gr.HTML("""<h1 style="font-weight:600;font-size:50;margin-top:4px;margin-bottom:4px;text-align:center;">Text to Code Generation</h1></div>""") | |
| model_choice = gr.Dropdown(label="Select Model", choices=[m for m in names], type="index", interactive=True) | |
| input_text = gr.Textbox(label="Input Prompt") | |
| output_window = gr.Code(label="Generated Code") | |
| title="Text to Code Generation Models Comparison" | |
| interface = gr.Interface(fn=the_process, inputs=[input_text, model_choice], outputs="text", title = title) | |
| interface.launch() |