Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
|
|
1 |
import torch
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
3 |
import gradio as gr
|
4 |
-
import spaces
|
5 |
|
6 |
title = """# 🙋🏻♂️Welcome to 🌟Tonic's Defog 🌬️🌁🌫️SqlCoder-34B-Alpha
|
7 |
You can use this Space to test out the current model [defog/sqlcoder-34b-alpha](https://huggingface.co/defog/sqlcoder-34b-alpha). [defog/sqlcoder-34b-alpha](https://huggingface.co/defog/sqlcoder-34b-alpha) is a 34B parameter model that outperforms gpt-4 and gpt-4-turbo for natural language to SQL generation tasks on our sql-eval framework, and significantly outperforms all popular open-source models. SQLCoder-34B is fine-tuned on a base CodeLlama model.
|
@@ -64,14 +64,15 @@ class SQLQueryGenerator:
|
|
64 |
)
|
65 |
return generated_query
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
def main():
|
68 |
model_name = "defog/sqlcoder-34b-alpha"
|
69 |
sql_query_generator = SQLQueryGenerator(model_name)
|
70 |
|
71 |
-
@spaces.GPU
|
72 |
-
def generate_sql(question):
|
73 |
-
return sql_query_generator.run_inference(question)
|
74 |
-
|
75 |
with gr.Blocks() as demo:
|
76 |
gr.Markdown(title)
|
77 |
question = gr.Textbox(label="Enter your question")
|
|
|
1 |
+
import spaces
|
2 |
import torch
|
3 |
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
title = """# 🙋🏻♂️Welcome to 🌟Tonic's Defog 🌬️🌁🌫️SqlCoder-34B-Alpha
|
7 |
You can use this Space to test out the current model [defog/sqlcoder-34b-alpha](https://huggingface.co/defog/sqlcoder-34b-alpha). [defog/sqlcoder-34b-alpha](https://huggingface.co/defog/sqlcoder-34b-alpha) is a 34B parameter model that outperforms gpt-4 and gpt-4-turbo for natural language to SQL generation tasks on our sql-eval framework, and significantly outperforms all popular open-source models. SQLCoder-34B is fine-tuned on a base CodeLlama model.
|
|
|
64 |
)
|
65 |
return generated_query
|
66 |
|
67 |
+
|
68 |
+
@spaces.GPU # Decorate this function to use GPU
|
69 |
+
def generate_sql(question):
|
70 |
+
return sql_query_generator.run_inference(question)
|
71 |
+
|
72 |
def main():
|
73 |
model_name = "defog/sqlcoder-34b-alpha"
|
74 |
sql_query_generator = SQLQueryGenerator(model_name)
|
75 |
|
|
|
|
|
|
|
|
|
76 |
with gr.Blocks() as demo:
|
77 |
gr.Markdown(title)
|
78 |
question = gr.Textbox(label="Enter your question")
|