Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +37 -0
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
app.py
CHANGED
|
@@ -92,6 +92,18 @@ _ft_hf_model_id: str | None = None
|
|
| 92 |
FINETUNED_HUB_MODEL_ID = "Tuana/qwen35-08b-text2sql"
|
| 93 |
BASE_MODEL_ID = "Qwen/Qwen3.5-0.8B"
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
def _env(name: str, default: str = "") -> str:
|
| 96 |
v = os.environ.get(name)
|
| 97 |
if v is None or str(v).strip() == "":
|
|
@@ -696,6 +708,22 @@ def main() -> None:
|
|
| 696 |
button_primary_text_color="#ffffff",
|
| 697 |
input_background_fill="#0b1628",
|
| 698 |
input_border_color="#2d3f5f",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 699 |
)
|
| 700 |
css = """
|
| 701 |
.gradio-container {
|
|
@@ -783,14 +811,23 @@ def main() -> None:
|
|
| 783 |
}
|
| 784 |
"""
|
| 785 |
|
|
|
|
|
|
|
| 786 |
with gr.Blocks(title=title, theme=theme, css=css) as demo:
|
| 787 |
gr.Markdown(hero)
|
| 788 |
gr.HTML(_database_preview_html())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 789 |
inp = gr.Textbox(
|
| 790 |
label="Ask the database",
|
|
|
|
| 791 |
placeholder="e.g. List all department names.",
|
| 792 |
lines=4,
|
| 793 |
)
|
|
|
|
| 794 |
btn = gr.Button("Generate and compare SQL", variant="primary")
|
| 795 |
with gr.Row(equal_height=False):
|
| 796 |
with gr.Column(scale=1):
|
|
|
|
| 92 |
FINETUNED_HUB_MODEL_ID = "Tuana/qwen35-08b-text2sql"
|
| 93 |
BASE_MODEL_ID = "Qwen/Qwen3.5-0.8B"
|
| 94 |
|
| 95 |
+
DEMO_QUESTION_EXAMPLES: tuple[str, ...] = (
|
| 96 |
+
"Count how many management rows exist per temporary_acting value",
|
| 97 |
+
"List all department names.",
|
| 98 |
+
"Count how many management rows exist per department."
|
| 99 |
+
"Which departments were created before the year 2000?",
|
| 100 |
+
"For each department, show the department name and the name of its head.",
|
| 101 |
+
"List the names of heads who were born in Alabama.",
|
| 102 |
+
"Which heads are temporary acting in their management role?",
|
| 103 |
+
"How many departments are there?",
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
def _env(name: str, default: str = "") -> str:
|
| 108 |
v = os.environ.get(name)
|
| 109 |
if v is None or str(v).strip() == "":
|
|
|
|
| 708 |
button_primary_text_color="#ffffff",
|
| 709 |
input_background_fill="#0b1628",
|
| 710 |
input_border_color="#2d3f5f",
|
| 711 |
+
checkbox_label_background_fill="#0b1628",
|
| 712 |
+
checkbox_label_background_fill_dark="#0b1628",
|
| 713 |
+
checkbox_label_background_fill_hover="#152238",
|
| 714 |
+
checkbox_label_background_fill_hover_dark="#152238",
|
| 715 |
+
checkbox_label_background_fill_selected="#7c3aed",
|
| 716 |
+
checkbox_label_background_fill_selected_dark="#7c3aed",
|
| 717 |
+
checkbox_label_border_color="#2d3f5f",
|
| 718 |
+
checkbox_label_border_color_dark="#2d3f5f",
|
| 719 |
+
checkbox_label_border_color_hover="#3d5278",
|
| 720 |
+
checkbox_label_border_color_hover_dark="#3d5278",
|
| 721 |
+
checkbox_label_border_color_selected="#c4b5fd",
|
| 722 |
+
checkbox_label_border_color_selected_dark="#c4b5fd",
|
| 723 |
+
checkbox_label_text_color="#e5edf8",
|
| 724 |
+
checkbox_label_text_color_dark="#e5edf8",
|
| 725 |
+
checkbox_label_text_color_selected="#ffffff",
|
| 726 |
+
checkbox_label_text_color_selected_dark="#ffffff",
|
| 727 |
)
|
| 728 |
css = """
|
| 729 |
.gradio-container {
|
|
|
|
| 811 |
}
|
| 812 |
"""
|
| 813 |
|
| 814 |
+
_default_question = DEMO_QUESTION_EXAMPLES[0]
|
| 815 |
+
|
| 816 |
with gr.Blocks(title=title, theme=theme, css=css) as demo:
|
| 817 |
gr.Markdown(hero)
|
| 818 |
gr.HTML(_database_preview_html())
|
| 819 |
+
example_radio = gr.Radio(
|
| 820 |
+
label="Example question",
|
| 821 |
+
choices=list(DEMO_QUESTION_EXAMPLES),
|
| 822 |
+
value=_default_question,
|
| 823 |
+
)
|
| 824 |
inp = gr.Textbox(
|
| 825 |
label="Ask the database",
|
| 826 |
+
value=_default_question,
|
| 827 |
placeholder="e.g. List all department names.",
|
| 828 |
lines=4,
|
| 829 |
)
|
| 830 |
+
example_radio.change(fn=lambda q: q, inputs=example_radio, outputs=inp)
|
| 831 |
btn = gr.Button("Generate and compare SQL", variant="primary")
|
| 832 |
with gr.Row(equal_height=False):
|
| 833 |
with gr.Column(scale=1):
|