LegendaryToe commited on
Commit
523a420
·
1 Parent(s): 9753a3a
Files changed (1) hide show
  1. app.py +35 -18
app.py CHANGED
@@ -1,25 +1,42 @@
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')
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
 
 
 
 
 
 
 
 
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')
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
+
26
+ import streamlit as st
27
+ from transformers import pipeline
28
+
29
+ # Load the NER model
30
+ ner = pipeline("ner", model="dbmdz/bert-large-cased-finetuned-conll03-english", grouped_entities=True)
31
+
32
+ st.title('Hello World NER Parser')
33
 
34
+ # User input for text
35
+ user_input = st.text_area("Enter a sentence to parse for named entities:", "John Smith lives in San Francisco.")
 
36
 
37
+ # Parse entities
38
+ if st.button('Parse'):
39
+ entities = ner(user_input)
40
+ # Display extracted entities
41
+ for entity in entities:
42
+ st.write(f"Entity: {entity['word']}, Entity Type: {entity['entity_group']}")