Spaces:
Runtime error
Runtime error
LegendaryToe
commited on
Commit
·
5e6328b
1
Parent(s):
523a420
cp
Browse files
app.py
CHANGED
@@ -23,20 +23,39 @@
|
|
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
|
30 |
-
|
|
|
31 |
|
32 |
-
st.title('
|
33 |
|
34 |
# User input for text
|
35 |
-
user_input = st.text_area("Enter
|
36 |
-
|
37 |
-
#
|
38 |
-
if st.button('
|
39 |
-
|
40 |
-
# Display extracted
|
41 |
-
|
42 |
-
st.write(f"Entity: {entity['word']}, Entity Type: {entity['entity_group']}")
|
|
|
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']}")
|
43 |
+
|
44 |
+
|
45 |
import streamlit as st
|
46 |
from transformers import pipeline
|
47 |
|
48 |
+
# Load CodeBERT model as a feature extractor
|
49 |
+
# (Note: You may need to adjust the task if using CodeBERT for other specific purposes)
|
50 |
+
codebert = pipeline("feature-extraction", model="microsoft/codebert-base")
|
51 |
|
52 |
+
st.title('CodeBERT Feature Extractor')
|
53 |
|
54 |
# User input for text
|
55 |
+
user_input = st.text_area("Enter code or text to extract features:", "SELECT * FROM users;")
|
56 |
+
|
57 |
+
# Extract features
|
58 |
+
if st.button('Extract Features'):
|
59 |
+
features = codebert(user_input)
|
60 |
+
# Display extracted features (example: show size of feature vector for demonstration)
|
61 |
+
st.write('Number of features extracted:', len(features[0][0]))
|
|