Commit
·
ba3b60e
1
Parent(s):
1a7b39d
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,9 +43,11 @@ class StopOnTokens(StoppingCriteria):
|
|
| 43 |
return False
|
| 44 |
|
| 45 |
def bot(input_message: str, temperature=0.1, top_p=0.9, top_k=0, repetition_penalty=1.08):
|
|
|
|
| 46 |
stop = StopOnTokens()
|
| 47 |
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
input_ids = tok(messages, return_tensors="pt").input_ids
|
| 51 |
input_ids = input_ids.to(m.device)
|
|
@@ -86,6 +88,7 @@ gradio_interface = gr.Interface(
|
|
| 86 |
fn=bot,
|
| 87 |
inputs=[
|
| 88 |
gr.Textbox(lines=20, placeholder='Input text here...', label='Input Text'),
|
|
|
|
| 89 |
gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, value=0.1, step=0.1),
|
| 90 |
gr.Slider(label="Top-p (nucleus sampling)", minimum=0.0, maximum=1.0, value=0.9, step=0.01),
|
| 91 |
gr.Slider(label="Top-k", minimum=0, maximum=200, value=0, step=1),
|
|
@@ -103,4 +106,7 @@ gradio_interface = gr.Interface(
|
|
| 103 |
]
|
| 104 |
)
|
| 105 |
|
|
|
|
|
|
|
|
|
|
| 106 |
gradio_interface.launch()
|
|
|
|
| 43 |
return False
|
| 44 |
|
| 45 |
def bot(input_message: str, temperature=0.1, top_p=0.9, top_k=0, repetition_penalty=1.08):
|
| 46 |
+
def bot(input_message: str, temperature=0.1, top_p=0.9, top_k=0, repetition_penalty=1.08):
|
| 47 |
stop = StopOnTokens()
|
| 48 |
|
| 49 |
+
# Format the user's input message
|
| 50 |
+
messages = f"Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.\n\n### Instruction:\n\nConvert text to sql: {input_message}\n\n### Response:\n\n"
|
| 51 |
|
| 52 |
input_ids = tok(messages, return_tensors="pt").input_ids
|
| 53 |
input_ids = input_ids.to(m.device)
|
|
|
|
| 88 |
fn=bot,
|
| 89 |
inputs=[
|
| 90 |
gr.Textbox(lines=20, placeholder='Input text here...', label='Input Text'),
|
| 91 |
+
gr.Textbox(lines=20, placeholder='(Recommended) Example: | stadium : stadium_id , location , name , capacity , highest , lowest , average | singer : singer_id , name , country , song_name , song_release_year , age , is_male | concert : concert_id , concert_name , theme , stadium_id , year | singer_in_concert : concert_id , singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | ', label='Databse Info'),
|
| 92 |
gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, value=0.1, step=0.1),
|
| 93 |
gr.Slider(label="Top-p (nucleus sampling)", minimum=0.0, maximum=1.0, value=0.9, step=0.01),
|
| 94 |
gr.Slider(label="Top-k", minimum=0, maximum=200, value=0, step=1),
|
|
|
|
| 106 |
]
|
| 107 |
)
|
| 108 |
|
| 109 |
+
gradio_interface.launch()
|
| 110 |
+
|
| 111 |
+
|
| 112 |
gradio_interface.launch()
|