Spaces:
Runtime error
Runtime error
File size: 2,032 Bytes
523a420 526afa6 523a420 526afa6 523a420 ec6901a 523a420 1a2a575 523a420 1a2a575 523a420 5e6328b 523a420 c07c602 523a420 1a2a575 5e6328b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# import streamlit as st
# from transformers import pipeline
# # Load the SQLCoder model
# sql_generator = pipeline('text-generation', model='defog/sqlcoder')
# st.title('SQL Table Extractor')
# # Text input for SQL query
# user_sql = st.text_input("Enter your SQL statement", "SELECT * FROM my_table WHERE condition;")
# # Button to parse SQL
# if st.button('Extract Tables'):
# # Generate SQL or parse directly
# results = sql_generator(user_sql)
# # Assuming results contain SQL, extract table names (this part may require custom logic based on output)
# tables = extract_tables_from_sql(results)
# # Display extracted table names
# st.write('Extracted Tables:', tables)
# def extract_tables_from_sql(sql):
# # Dummy function: Implement logic to parse table names from SQL
# return ["my_table"] # Example output
# import streamlit as st
# from transformers import pipeline
# # Load the NER model
# ner = pipeline("ner", model="dbmdz/bert-large-cased-finetuned-conll03-english", grouped_entities=True)
# st.title('Hello World NER Parser')
# # User input for text
# user_input = st.text_area("Enter a sentence to parse for named entities:", "John Smith lives in San Francisco.")
# # Parse entities
# if st.button('Parse'):
# entities = ner(user_input)
# # Display extracted entities
# for entity in entities:
# st.write(f"Entity: {entity['word']}, Entity Type: {entity['entity_group']}")
import streamlit as st
from transformers import pipeline
# Load a smaller LLaMA model with permission to run custom code
text_generator = pipeline("text-generation", model="microsoft/Phi-3-mini-128k-instruct", trust_remote_code=True)
st.title('General Query Answerer')
# User input for a general question
user_query = st.text_area("Enter your question:", "Name all 50 US states.")
# Generate answer
if st.button('Answer Question'):
answer = text_generator(user_query, max_length=150)[0]['generated_text']
# Display the answer
st.write('Answer:', answer)
|