Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import gradio as gr
|
|
| 4 |
|
| 5 |
# Module imports
|
| 6 |
from utilities.setup import get_json_cfg
|
|
|
|
| 7 |
|
| 8 |
########################### Global objects and functions ###########################
|
| 9 |
|
|
@@ -25,7 +26,7 @@ def upload_visibility(radio):
|
|
| 25 |
|
| 26 |
def greet(model_name, prompt_template, name, dataset):
|
| 27 |
"""The model call"""
|
| 28 |
-
return f"Hello {name}!! Using model: {model_name} with template: {
|
| 29 |
|
| 30 |
##################################### App UI #######################################
|
| 31 |
with gr.Blocks() as demo:
|
|
@@ -36,9 +37,13 @@ with gr.Blocks() as demo:
|
|
| 36 |
##### Model Inputs #####
|
| 37 |
|
| 38 |
# Select Model
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
# Prompt template
|
| 41 |
-
|
|
|
|
| 42 |
# Prompt Input
|
| 43 |
name_input = gr.Textbox(label="Your Name")
|
| 44 |
# Dataset choice
|
|
|
|
| 4 |
|
| 5 |
# Module imports
|
| 6 |
from utilities.setup import get_json_cfg
|
| 7 |
+
from utilities.templates import prompt_template
|
| 8 |
|
| 9 |
########################### Global objects and functions ###########################
|
| 10 |
|
|
|
|
| 26 |
|
| 27 |
def greet(model_name, prompt_template, name, dataset):
|
| 28 |
"""The model call"""
|
| 29 |
+
return f"Hello {name}!! Using model: {model_name} with template: {inject_prompt}"
|
| 30 |
|
| 31 |
##################################### App UI #######################################
|
| 32 |
with gr.Blocks() as demo:
|
|
|
|
| 37 |
##### Model Inputs #####
|
| 38 |
|
| 39 |
# Select Model
|
| 40 |
+
modelnames = conf['model']['choices']
|
| 41 |
+
model_name = gr.Dropdown(label="Supported Models",
|
| 42 |
+
choices=modelnames,
|
| 43 |
+
value=modelnames[0])
|
| 44 |
# Prompt template
|
| 45 |
+
inject_prompt = gr.Textbox(label="Prompt Template",
|
| 46 |
+
value=prompt_template())
|
| 47 |
# Prompt Input
|
| 48 |
name_input = gr.Textbox(label="Your Name")
|
| 49 |
# Dataset choice
|