Spaces:
Sleeping
Sleeping
Shankarm08
commited on
Commit
•
56a2cc3
1
Parent(s):
13aa3a5
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
-
from dotenv import load_dotenv
|
4 |
from langchain import HuggingFaceHub
|
5 |
|
6 |
# Load environment variables from the .env file
|
@@ -15,6 +15,7 @@ def load_sql_query(question):
|
|
15 |
# Initialize the Hugging Face model using LangChain's HuggingFaceHub class
|
16 |
llm = HuggingFaceHub(
|
17 |
repo_id="Salesforce/grappa_large_jnt", # Hugging Face model repo for text-to-SQL
|
|
|
18 |
huggingfacehub_api_token=HUGGINGFACE_API_TOKEN, # Pass your API token
|
19 |
model_kwargs={"temperature": 0.3} # Optional: Adjust response randomness
|
20 |
)
|
@@ -48,3 +49,4 @@ if submit and user_input:
|
|
48 |
st.write(response)
|
49 |
elif submit:
|
50 |
st.warning("Please enter a question.") # Warning for empty input
|
|
|
|
1 |
import os
|
2 |
import streamlit as st
|
3 |
+
from dotenv import load_dotenv
|
4 |
from langchain import HuggingFaceHub
|
5 |
|
6 |
# Load environment variables from the .env file
|
|
|
15 |
# Initialize the Hugging Face model using LangChain's HuggingFaceHub class
|
16 |
llm = HuggingFaceHub(
|
17 |
repo_id="Salesforce/grappa_large_jnt", # Hugging Face model repo for text-to-SQL
|
18 |
+
task="text2text-generation", # Set the task to 'text2text-generation'
|
19 |
huggingfacehub_api_token=HUGGINGFACE_API_TOKEN, # Pass your API token
|
20 |
model_kwargs={"temperature": 0.3} # Optional: Adjust response randomness
|
21 |
)
|
|
|
49 |
st.write(response)
|
50 |
elif submit:
|
51 |
st.warning("Please enter a question.") # Warning for empty input
|
52 |
+
|