File size: 942 Bytes
bb8ab8a
 
4012189
 
 
0e84598
4012189
 
72e23af
 
 
4012189
 
 
 
 
 
 
 
72e23af
 
 
 
4012189
72e23af
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr

models=[
    "nadiamaqbool81/starcoderbase-1b-hf",   
    "nadiamaqbool81/starcoderbase-1b-hf_python",
    "nadiamaqbool81/starcoderbase-1b-hf_python",    
]
model_box=[
    gr.load(f"models/{models[0]}"),
    gr.load(f"models/{models[1]}"),
    gr.load(f"models/{models[2]}"),
]
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 models], type="index", interactive=True)
    input_text = gr.Textbox(label="Input Prompt")
    output_window = gr.Textbox(label="Generated Code")

interface = gr.Interface(fn=the_process, inputs=[input_text, model_choice], outputs="text")
interface.launch()