Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
| 3 |
def greet(model_name, prompt_template, name):
|
| 4 |
return f"Hello {name}!! Using model: {model_name} with template: {prompt_template}"
|
| 5 |
|
| 6 |
model_choices = ["gpt2", "bert-base-uncased", "llama3-8b"]
|
| 7 |
|
|
|
|
|
|
|
| 8 |
with gr.Blocks() as demo:
|
| 9 |
gr.Markdown("# Instruction Tuning with Unsloth")
|
| 10 |
model_name = gr.Dropdown(label="Model", choices=model_choices, value="gpt2")
|
|
@@ -18,4 +23,8 @@ with gr.Blocks() as demo:
|
|
| 18 |
inputs=[model_name, prompt_template, name_input],
|
| 19 |
outputs=output)
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##################################### Imports ######################################
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
|
| 5 |
+
########################### Global objects and functions ###########################
|
| 6 |
def greet(model_name, prompt_template, name):
|
| 7 |
return f"Hello {name}!! Using model: {model_name} with template: {prompt_template}"
|
| 8 |
|
| 9 |
model_choices = ["gpt2", "bert-base-uncased", "llama3-8b"]
|
| 10 |
|
| 11 |
+
|
| 12 |
+
##################################### App UI #######################################
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
gr.Markdown("# Instruction Tuning with Unsloth")
|
| 15 |
model_name = gr.Dropdown(label="Model", choices=model_choices, value="gpt2")
|
|
|
|
| 23 |
inputs=[model_name, prompt_template, name_input],
|
| 24 |
outputs=output)
|
| 25 |
|
| 26 |
+
|
| 27 |
+
##################################### Launch #######################################
|
| 28 |
+
|
| 29 |
+
if ___name__ == "__main__":
|
| 30 |
+
demo.launch()
|