Spaces:
Runtime error
Runtime error
Commit
·
4012189
1
Parent(s):
bb8ab8a
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,32 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
models=[
|
4 |
+
"nadiamaqbool81/starcoderbase-1b-hf",
|
5 |
+
"nadiamaqbool81/starcoderbase-1b-hf_python",
|
6 |
+
"nitrosocke/redshift-diffusion",
|
7 |
+
]
|
8 |
+
model_box=[
|
9 |
+
gr.Interface.load(f"models/{models[0]}",live=True,preprocess=True),
|
10 |
+
gr.Interface.load(f"models/{models[1]}",live=True,preprocess=True),
|
11 |
+
gr.Interface.load(f"models/{models[2]}",live=True,preprocess=True),
|
12 |
+
]
|
13 |
+
current_model=model_box[0]
|
14 |
+
|
15 |
+
def the_process(input_text, model_choice):
|
16 |
+
a_variable = model_box[model_choice]
|
17 |
+
output = a_variable(input_text)
|
18 |
+
return(output)
|
19 |
+
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
gr.HTML("""<h1 style="font-weight:600;font-size:50;margin-top:4px;margin-bottom:4px;text-align:center;">Example Space to copy/paste</h1></div>""")
|
22 |
+
with gr.Row():
|
23 |
+
with gr.Column():
|
24 |
+
model_choice = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index", interactive=True)
|
25 |
+
input_text = gr.Textbox(label="Input Prompt")
|
26 |
+
the_button = gr.Button()
|
27 |
+
with gr.Column():
|
28 |
+
output_window = gr.Code(label="Generated Code")
|
29 |
+
|
30 |
+
the_button.click(the_process, inputs=[input_text, model_choice], outputs=[output_window])
|
31 |
+
|
32 |
+
demo.launch()
|