Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,12 @@ from datasets import load_dataset
|
|
6 |
tokenizer = T5Tokenizer.from_pretrained('t5-small')
|
7 |
model = T5ForConditionalGeneration.from_pretrained('t5-small')
|
8 |
|
9 |
-
dataset = load_dataset("wikisql", split='test')
|
|
|
|
|
|
|
|
|
|
|
10 |
def generate_sql(question):
|
11 |
# Format the question for the model if needed. For example:
|
12 |
# input_text = f"translate English to SQL: {question}"
|
@@ -22,7 +27,6 @@ def generate_sql(question):
|
|
22 |
sql_query = tokenizer.decode(output_ids, skip_special_tokens=True)
|
23 |
return sql_query
|
24 |
|
25 |
-
examples = [[item['question']] for item in dataset]
|
26 |
|
27 |
# Define the Gradio interface
|
28 |
iface = gr.Interface(
|
|
|
6 |
tokenizer = T5Tokenizer.from_pretrained('t5-small')
|
7 |
model = T5ForConditionalGeneration.from_pretrained('t5-small')
|
8 |
|
9 |
+
dataset = load_dataset("wikisql", split='test')
|
10 |
+
for i in range(3): # Let's take the first 3 examples
|
11 |
+
item = dataset[i]
|
12 |
+
question = item['question']
|
13 |
+
examples.append([question])
|
14 |
+
|
15 |
def generate_sql(question):
|
16 |
# Format the question for the model if needed. For example:
|
17 |
# input_text = f"translate English to SQL: {question}"
|
|
|
27 |
sql_query = tokenizer.decode(output_ids, skip_special_tokens=True)
|
28 |
return sql_query
|
29 |
|
|
|
30 |
|
31 |
# Define the Gradio interface
|
32 |
iface = gr.Interface(
|