Spaces:
Runtime error
Runtime error
SimFG
commited on
Commit
Β·
52260ed
1
Parent(s):
c35b520
Add the example desc
Browse files
app.py
CHANGED
@@ -54,18 +54,45 @@ def query(question):
|
|
54 |
if __name__ == "__main__":
|
55 |
block = gr.Blocks()
|
56 |
with block as demo:
|
57 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
url_list_text = gr.Textbox(
|
59 |
-
label="
|
60 |
lines=3,
|
|
|
61 |
)
|
62 |
-
openai_key_text = gr.Textbox(label="openai api key")
|
63 |
with gr.Row():
|
64 |
-
zilliz_uri_text = gr.Textbox(
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
69 |
loader_btn.click(
|
70 |
fn=web_loader,
|
71 |
inputs=[
|
@@ -82,6 +109,7 @@ if __name__ == "__main__":
|
|
82 |
question_text = gr.Textbox(
|
83 |
label="question",
|
84 |
lines=3,
|
|
|
85 |
)
|
86 |
query_output = gr.Textbox(label="question answer", lines=3)
|
87 |
query_btn = gr.Button("Generate")
|
|
|
54 |
if __name__ == "__main__":
|
55 |
block = gr.Blocks()
|
56 |
with block as demo:
|
57 |
+
gr.Markdown(
|
58 |
+
"""
|
59 |
+
<h1><center>Langchain And Zilliz Cloud Example</center></h1>
|
60 |
+
This is how to use Zilliz Cloud as vector store in LangChain.
|
61 |
+
The purpose of this example is to allow you to input multiple URLs (separated by newlines) and then ask questions about the content of the corresponding web pages.
|
62 |
+
|
63 |
+
## π Prerequisite:
|
64 |
+
|
65 |
+
1. π To obtain an OpenAI key, please visit https://platform.openai.com/account/api-keys.
|
66 |
+
2. π» Create a Zilliz Cloud account to get free credits for usage by visiting https://cloud.zilliz.com.
|
67 |
+
3. ποΈ Create a database in Zilliz Cloud.
|
68 |
+
|
69 |
+
## π Steps for usage:
|
70 |
+
|
71 |
+
1. ποΈ Fill in the url list input box with multiple URLs.
|
72 |
+
2. π Fill in the OpenAI API key in the openai api key input box.
|
73 |
+
3. π©οΈ Fill in the Zilliz Cloud connection parameters, including the connection URL, corresponding username, and password.
|
74 |
+
4. π Click the Load Data button to load the data. When the load status text box prompts that the data has been successfully loaded, proceed to the next step.
|
75 |
+
5. β In the question input box, enter the relevant question about the web page.
|
76 |
+
6. π Click the Generate button to search for the answer to the question. The final answer will be displayed in the question answer text box.
|
77 |
+
"""
|
78 |
+
)
|
79 |
url_list_text = gr.Textbox(
|
80 |
+
label="url list",
|
81 |
lines=3,
|
82 |
+
placeholder="https://milvus.io/docs/overview.md",
|
83 |
)
|
84 |
+
openai_key_text = gr.Textbox(label="openai api key", placeholder="sk-******")
|
85 |
with gr.Row():
|
86 |
+
zilliz_uri_text = gr.Textbox(
|
87 |
+
label="zilliz cloud uri",
|
88 |
+
placeholder="https://<instance-id>.<cloud-region-id>.vectordb.zillizcloud.com:<port>",
|
89 |
+
)
|
90 |
+
user_text = gr.Textbox(label="username", placeholder="db_admin")
|
91 |
+
password_text = gr.Textbox(
|
92 |
+
label="password", type="password", placeholder="******"
|
93 |
+
)
|
94 |
+
loader_output = gr.Textbox(label="load status")
|
95 |
+
loader_btn = gr.Button("Load Data")
|
96 |
loader_btn.click(
|
97 |
fn=web_loader,
|
98 |
inputs=[
|
|
|
109 |
question_text = gr.Textbox(
|
110 |
label="question",
|
111 |
lines=3,
|
112 |
+
placeholder="What is milvus?",
|
113 |
)
|
114 |
query_output = gr.Textbox(label="question answer", lines=3)
|
115 |
query_btn = gr.Button("Generate")
|