Spaces:
Runtime error
Runtime error
LegendaryToe
commited on
Commit
·
1a2a575
1
Parent(s):
cfe9d20
cp
Browse files
app.py
CHANGED
@@ -1,17 +1,25 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
5 |
-
|
6 |
|
7 |
-
st.title('
|
8 |
|
9 |
-
# Text input
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
# Generate text button
|
13 |
-
if st.button('Generate'):
|
14 |
-
# Generate text
|
15 |
-
result = generator(user_input, max_length=50, num_return_sequences=1)
|
16 |
-
# Display the generated text
|
17 |
-
st.text_area("Generated Text", result[0]['generated_text'], height=150)
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the SQLCoder model
|
5 |
+
sql_generator = pipeline('text-generation', model='defog/sqlcoder-7b-2')
|
6 |
|
7 |
+
st.title('SQL Table Extractor')
|
8 |
|
9 |
+
# Text input for SQL query
|
10 |
+
user_sql = st.text_input("Enter your SQL statement", "SELECT * FROM my_table WHERE condition;")
|
11 |
+
|
12 |
+
# Button to parse SQL
|
13 |
+
if st.button('Extract Tables'):
|
14 |
+
# Generate SQL or parse directly
|
15 |
+
results = sql_generator(user_sql)
|
16 |
+
# Assuming results contain SQL, extract table names (this part may require custom logic based on output)
|
17 |
+
tables = extract_tables_from_sql(results)
|
18 |
+
|
19 |
+
# Display extracted table names
|
20 |
+
st.write('Extracted Tables:', tables)
|
21 |
+
|
22 |
+
def extract_tables_from_sql(sql):
|
23 |
+
# Dummy function: Implement logic to parse table names from SQL
|
24 |
+
return ["my_table"] # Example output
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|