CoolFace
Apppublic

nadiamaqbool81/UserInterface

sourceHugging Facellama2updated 2y agoView on Hugging Face
0likes
app.py40 linesDownload Raw Back to root
1import gradio as gr2 3models=[4    "nadiamaqbool81/starcoderbase-1b-hf",   5    "nadiamaqbool81/starcoderbase-1b-hf_python",6    "nadiamaqbool81/codet5-large-hf",7    "nadiamaqbool81/codet5-large-hf-python",    8    "nadiamaqbool81/llama-2-7b-int4-java-code-1.178k",9    "nadiamaqbool81/llama-2-7b-int4-python-code-510"10]11names=[12    "nadiamaqbool81/starcoderbase-java",   13    "nadiamaqbool81/starcoderbase-python",14    "nadiamaqbool81/codet5-java",15    "nadiamaqbool81/codet5-python",    16    "nadiamaqbool81/llama-2-java",17    "nadiamaqbool81/llama-2-python"18]19model_box=[20    gr.load(f"models/{models[0]}"),21    gr.load(f"models/{models[1]}"),22    gr.load(f"models/{models[2]}"),23    gr.load(f"models/{models[3]}"),24    gr.load(f"models/{models[4]}"),25    gr.load(f"models/{models[5]}"),26]27current_model=model_box[0]28 29def the_process(input_text, model_choice):30    a_variable = model_box[model_choice]31    output = a_variable(input_text)32    return(output)33 34gr.HTML("""<h1 style="font-weight:600;font-size:50;margin-top:4px;margin-bottom:4px;text-align:center;">Text to Code Generation</h1></div>""")35model_choice = gr.Dropdown(label="Select Model", choices=[m for m in names], type="index", interactive=True)36input_text = gr.Textbox(label="Input Prompt")37output_window = gr.Code(label="Generated Code")38title="Text to Code Generation Models Comparison"39interface = gr.Interface(fn=the_process, inputs=[input_text, model_choice], outputs="text", title = title)40interface.launch()