iShare commited on
Commit
41a17c2
·
1 Parent(s): ab56333

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -30,6 +30,7 @@ llm = HuggingFaceHub(repo_id=repo_id, #for Llama2
30
  #llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k")
31
  chain = load_summarize_chain(llm, chain_type="stuff")
32
 
 
33
  url=st.text_input("Enter webiste URL to summarize (format: https://www.usinoip.com):")
34
  #loader = WebBaseLoader("https://www.usinoip.com/")
35
  loader = WebBaseLoader(url)
@@ -39,6 +40,25 @@ with st.spinner("AI Thinking...Please wait a while to Cheers!"):
39
  print(result)
40
  st.write("AI Summarization:")
41
  st.write(result)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  #try:
44
  # loader = WebBaseLoader(url)
 
30
  #llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k")
31
  chain = load_summarize_chain(llm, chain_type="stuff")
32
 
33
+ #**************************************************************#
34
  url=st.text_input("Enter webiste URL to summarize (format: https://www.usinoip.com):")
35
  #loader = WebBaseLoader("https://www.usinoip.com/")
36
  loader = WebBaseLoader(url)
 
40
  print(result)
41
  st.write("AI Summarization:")
42
  st.write(result)
43
+ #**************************************************************#
44
+
45
+ #**************************************************************#
46
+ url=st.text_input("Enter webiste URL to summarize (format: https://www.usinoip.com):")
47
+
48
+ #loader = WebBaseLoader("https://www.usinoip.com/")
49
+
50
+ if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
51
+ try:
52
+ loader = WebBaseLoader(url)
53
+ with st.spinner("AI Thinking...Please wait a while to Cheers!"):
54
+ docs = loader.load()
55
+ result=chain.run(docs)
56
+ print(result)
57
+ st.write("AI Summarization:")
58
+ st.write(result)
59
+ except Exception as e:
60
+ st.write("Wrong URL")
61
+ #**************************************************************#
62
 
63
  #try:
64
  # loader = WebBaseLoader(url)