Update app.py
Browse files
app.py
CHANGED
|
@@ -30,47 +30,26 @@ chain = load_summarize_chain(llm, chain_type="refine")
|
|
| 30 |
|
| 31 |
#llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k")
|
| 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)
|
| 37 |
-
#with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
| 38 |
-
# docs = loader.load()
|
| 39 |
-
# result=chain.run(docs)
|
| 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 url !="" and not url.strip().isspace() and not url == "" and not url.strip() == "" and not url.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) #这个result的格式比较特殊,可以直接print,但不可以和其他字符串联合print输出
|
|
|
|
| 56 |
print(url)
|
|
|
|
|
|
|
| 57 |
#print("AI Summarization: "+result) #这个会出错,原因见上方
|
| 58 |
print("AI Summarization:")
|
| 59 |
-
print(result)
|
|
|
|
| 60 |
|
| 61 |
st.write("AI Summarization:")
|
| 62 |
-
st.write(result)
|
|
|
|
| 63 |
except Exception as e:
|
| 64 |
-
st.write("Wrong URL or URL not parsable.")
|
| 65 |
-
#**************************************************************#
|
| 66 |
-
|
| 67 |
-
#try:
|
| 68 |
-
# loader = WebBaseLoader(url)
|
| 69 |
-
# with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
| 70 |
-
# docs = loader.load()
|
| 71 |
-
# result=chain.run(docs)
|
| 72 |
-
# print(result)
|
| 73 |
-
# st.write("AI Summarization:")
|
| 74 |
-
# st.write(result)
|
| 75 |
-
#except Exception as e:
|
| 76 |
-
# st.write("Wrong URL")
|
|
|
|
| 30 |
|
| 31 |
#llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k")
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
url=st.text_input("Enter webiste URL to summarize (format: https://www.usinoip.com):")
|
| 34 |
|
|
|
|
|
|
|
| 35 |
if url !="" and not url.strip().isspace() and not url == "" and not url.strip() == "" and not url.isspace():
|
| 36 |
try:
|
| 37 |
loader = WebBaseLoader(url)
|
| 38 |
+
#loader = WebBaseLoader("https://www.usinoip.com/")
|
| 39 |
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
| 40 |
docs = loader.load()
|
| 41 |
result=chain.run(docs) #这个result的格式比较特殊,可以直接print,但不可以和其他字符串联合print输出
|
| 42 |
+
|
| 43 |
print(url)
|
| 44 |
+
ai_response-str(result)
|
| 45 |
+
|
| 46 |
#print("AI Summarization: "+result) #这个会出错,原因见上方
|
| 47 |
print("AI Summarization:")
|
| 48 |
+
#print(result)
|
| 49 |
+
print(ai_response)
|
| 50 |
|
| 51 |
st.write("AI Summarization:")
|
| 52 |
+
#st.write(result)
|
| 53 |
+
st.write(ai_response)
|
| 54 |
except Exception as e:
|
| 55 |
+
st.write("Wrong URL or URL not parsable.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|