richardr1126 commited on
Commit
cda468b
·
1 Parent(s): 32c2894
Files changed (1) hide show
  1. app-ngrok.py +5 -2
app-ngrok.py CHANGED
@@ -4,6 +4,9 @@ import sqlparse
4
  import requests
5
  from time import sleep
6
  import re
 
 
 
7
 
8
  def format(text):
9
  # Split the text by "|", and get the last element in the list which should be the final query
@@ -68,10 +71,10 @@ with gr.Blocks(theme='gradio/soft') as demo:
68
  header = gr.HTML("""
69
  <h1 style="text-align: center">SQL Skeleton WizardCoder Demo</h1>
70
  <h3 style="text-align: center">🕷️☠️🧙‍♂️ Generate SQL queries from Natural Language 🕷️☠️🧙‍♂️</h3>
71
- <p>Note: Should take around 30-60s to generate.</p>
72
  """)
73
 
74
  output_box = gr.Code(label="Generated SQL", lines=2, interactive=True)
 
75
  input_text = gr.Textbox(lines=3, placeholder='Write your question here...', label='NL Input')
76
  db_info = gr.Textbox(lines=4, placeholder='Example: | table_01 : column_01 , column_02 | table_02 : column_01 , column_02 | ...', label='Database Info')
77
 
@@ -91,7 +94,7 @@ with gr.Blocks(theme='gradio/soft') as demo:
91
  ["What are the number of concerts that occurred in the stadium with the largest capacity ?", "| 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 |"],
92
  ["How many male singers performed in concerts in the year 2023?", "| 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 |"],
93
  ["List the names of all singers who performed in a concert with the theme 'Rock'", "| 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 |"]
94
- ], inputs=[input_text, db_info, temperature, top_p, top_k, repetition_penalty], fn=generate, cache_examples=False if os.name == 'posix' or os.name == 'nt' else True, outputs=output_box)
95
 
96
  quantized_model = "richardr1126/spider-skeleton-wizard-coder-ggml"
97
  merged_model = "richardr1126/spider-skeleton-wizard-coder-merged"
 
4
  import requests
5
  from time import sleep
6
  import re
7
+ import platform
8
+
9
+ print(f"Running on {platform.system()}")
10
 
11
  def format(text):
12
  # Split the text by "|", and get the last element in the list which should be the final query
 
71
  header = gr.HTML("""
72
  <h1 style="text-align: center">SQL Skeleton WizardCoder Demo</h1>
73
  <h3 style="text-align: center">🕷️☠️🧙‍♂️ Generate SQL queries from Natural Language 🕷️☠️🧙‍♂️</h3>
 
74
  """)
75
 
76
  output_box = gr.Code(label="Generated SQL", lines=2, interactive=True)
77
+ note = gr.HTML("""<p style="font-size: 12px; text-align: center">⚠️ Should take 30-60s to generate</p>""")
78
  input_text = gr.Textbox(lines=3, placeholder='Write your question here...', label='NL Input')
79
  db_info = gr.Textbox(lines=4, placeholder='Example: | table_01 : column_01 , column_02 | table_02 : column_01 , column_02 | ...', label='Database Info')
80
 
 
94
  ["What are the number of concerts that occurred in the stadium with the largest capacity ?", "| 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 |"],
95
  ["How many male singers performed in concerts in the year 2023?", "| 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 |"],
96
  ["List the names of all singers who performed in a concert with the theme 'Rock'", "| 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 |"]
97
+ ], inputs=[input_text, db_info, temperature, top_p, top_k, repetition_penalty], fn=generate, cache_examples=False if platform.system() == "Windows" or platform.system() == "Darwin" else True, outputs=output_box)
98
 
99
  quantized_model = "richardr1126/spider-skeleton-wizard-coder-ggml"
100
  merged_model = "richardr1126/spider-skeleton-wizard-coder-merged"