Commit
·
9c4badc
1
Parent(s):
877baa1
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,6 @@ from transformers import (
|
|
| 10 |
from huggingface_hub import login
|
| 11 |
import gradio as gr
|
| 12 |
import torch
|
| 13 |
-
import markdown
|
| 14 |
|
| 15 |
login(os.getenv("HF_TOKEN", None))
|
| 16 |
|
|
@@ -77,17 +76,17 @@ def bot(input_message: str, db_info="", temperature=0.1, top_p=0.9, top_k=0, rep
|
|
| 77 |
partial_text += new_text
|
| 78 |
|
| 79 |
# Split the text by "|", and get the last element in the list which should be the final query
|
| 80 |
-
final_query = partial_text.split("|")[
|
| 81 |
# Convert SQL to markdown (not required, but just to show how to use the markdown module)
|
| 82 |
-
final_query_markdown =
|
| 83 |
-
return
|
| 84 |
|
| 85 |
|
| 86 |
gradio_interface = gr.Interface(
|
| 87 |
fn=bot,
|
| 88 |
inputs=[
|
| 89 |
-
gr.Textbox(lines=
|
| 90 |
-
gr.Textbox(lines=
|
| 91 |
gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, value=0.1, step=0.1),
|
| 92 |
gr.Slider(label="Top-p (nucleus sampling)", minimum=0.0, maximum=1.0, value=0.9, step=0.01),
|
| 93 |
gr.Slider(label="Top-k", minimum=0, maximum=200, value=0, step=1),
|
|
|
|
| 10 |
from huggingface_hub import login
|
| 11 |
import gradio as gr
|
| 12 |
import torch
|
|
|
|
| 13 |
|
| 14 |
login(os.getenv("HF_TOKEN", None))
|
| 15 |
|
|
|
|
| 76 |
partial_text += new_text
|
| 77 |
|
| 78 |
# Split the text by "|", and get the last element in the list which should be the final query
|
| 79 |
+
final_query = partial_text.split("|")[1].strip()
|
| 80 |
# Convert SQL to markdown (not required, but just to show how to use the markdown module)
|
| 81 |
+
final_query_markdown = "```sql\n{final_query}\n```"
|
| 82 |
+
return final_query_markdown
|
| 83 |
|
| 84 |
|
| 85 |
gradio_interface = gr.Interface(
|
| 86 |
fn=bot,
|
| 87 |
inputs=[
|
| 88 |
+
gr.Textbox(lines=4, placeholder='Input text here...', label='Input Text'),
|
| 89 |
+
gr.Textbox(lines=8, 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'),
|
| 90 |
gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, value=0.1, step=0.1),
|
| 91 |
gr.Slider(label="Top-p (nucleus sampling)", minimum=0.0, maximum=1.0, value=0.9, step=0.01),
|
| 92 |
gr.Slider(label="Top-k", minimum=0, maximum=200, value=0, step=1),
|