Commit ·
9b3347b
1
Parent(s): 620c22d
Update README.md
Browse files
README.md
CHANGED
|
@@ -44,4 +44,18 @@ def get_sql(query,tokenizer,model):
|
|
| 44 |
query="Show me the average age of of wines in Italy by provinces"
|
| 45 |
sql = get_sql(query,tokenizer,model)
|
| 46 |
print(sql)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
```
|
|
|
|
| 44 |
query="Show me the average age of of wines in Italy by provinces"
|
| 45 |
sql = get_sql(query,tokenizer,model)
|
| 46 |
print(sql)
|
| 47 |
+
|
| 48 |
+
#https://huggingface.co/mrm8488/t5-small-finetuned-wikiSQL
|
| 49 |
+
def get_sql(query):
|
| 50 |
+
input_text = "translate English to SQL: %s </s>" % query
|
| 51 |
+
features = tokenizer([input_text], return_tensors='pt')
|
| 52 |
+
|
| 53 |
+
output = model.generate(input_ids=features['input_ids'],
|
| 54 |
+
attention_mask=features['attention_mask'])
|
| 55 |
+
|
| 56 |
+
return tokenizer.decode(output[0])
|
| 57 |
+
|
| 58 |
+
query = "How many models were finetuned using BERT as base model?"
|
| 59 |
+
|
| 60 |
+
get_sql(query)
|
| 61 |
```
|