Spaces:
Running
Running
test model
#1
by
sunny333 - opened
app.py
CHANGED
|
@@ -3,8 +3,7 @@ from langchain.prompts import PromptTemplate
|
|
| 3 |
from langchain_groq import ChatGroq
|
| 4 |
from langchain.chains.summarize import load_summarize_chain
|
| 5 |
from langchain_community.document_loaders import YoutubeLoader,UnstructuredURLLoader
|
| 6 |
-
|
| 7 |
-
from dotenv import load_dotenv
|
| 8 |
|
| 9 |
# setting streamlit
|
| 10 |
st.set_page_config(page_title="DEmo for summarization")
|
|
@@ -21,17 +20,10 @@ st.markdown('''
|
|
| 21 |
# groq API
|
| 22 |
#with st.sidebar:
|
| 23 |
# groq_api_key = st.text_input("Groq API Key",value="",type="password")
|
| 24 |
-
|
| 25 |
my_url = st.text_input("URL")
|
| 26 |
|
| 27 |
-
llm = ChatGroq(
|
| 28 |
-
model="llama-3.1-8b-instant",
|
| 29 |
-
temperature=0,
|
| 30 |
-
max_tokens=None,
|
| 31 |
-
timeout=None,
|
| 32 |
-
max_retries=2
|
| 33 |
-
|
| 34 |
-
)
|
| 35 |
|
| 36 |
prompt_template="""
|
| 37 |
summarize the following content in not more than 400 words:
|
|
@@ -43,7 +35,7 @@ prompt=PromptTemplate(template=prompt_template,input_variables=["text"])
|
|
| 43 |
|
| 44 |
if st.button("Summarize the Content from YT or Website"):
|
| 45 |
## Validate all the inputs
|
| 46 |
-
if
|
| 47 |
st.error("Please provide the information to get started")
|
| 48 |
elif not validators.url(my_url):
|
| 49 |
st.error("Please enter a valid Url. It can may be a YT video utl or website url")
|
|
|
|
| 3 |
from langchain_groq import ChatGroq
|
| 4 |
from langchain.chains.summarize import load_summarize_chain
|
| 5 |
from langchain_community.document_loaders import YoutubeLoader,UnstructuredURLLoader
|
| 6 |
+
|
|
|
|
| 7 |
|
| 8 |
# setting streamlit
|
| 9 |
st.set_page_config(page_title="DEmo for summarization")
|
|
|
|
| 20 |
# groq API
|
| 21 |
#with st.sidebar:
|
| 22 |
# groq_api_key = st.text_input("Groq API Key",value="",type="password")
|
| 23 |
+
groq_api_key = "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"
|
| 24 |
my_url = st.text_input("URL")
|
| 25 |
|
| 26 |
+
llm = ChatGroq(model="Gemma-7b-It", groq_api_key=groq_api_key )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
prompt_template="""
|
| 29 |
summarize the following content in not more than 400 words:
|
|
|
|
| 35 |
|
| 36 |
if st.button("Summarize the Content from YT or Website"):
|
| 37 |
## Validate all the inputs
|
| 38 |
+
if not groq_api_key.strip() or not my_url.strip():
|
| 39 |
st.error("Please provide the information to get started")
|
| 40 |
elif not validators.url(my_url):
|
| 41 |
st.error("Please enter a valid Url. It can may be a YT video utl or website url")
|