Spaces:
Runtime error
Runtime error
Kedar Dabhadkar
commited on
Commit
·
4c8264f
1
Parent(s):
6ad7bf1
Upgrade to Fast Dash v0.2.3
Browse files
app.py
CHANGED
@@ -21,34 +21,24 @@ Answer:"""
|
|
21 |
query_config = QueryConfig(template=PROMPT, number_documents=5, max_tokens=2000, model="gpt-4")
|
22 |
|
23 |
# Define components
|
24 |
-
openai_api_key_component =
|
25 |
-
dmc.PasswordInput(
|
26 |
placeholder="API Key",
|
27 |
description="Get yours at https://platform.openai.com/account/api-keys",
|
28 |
required=True
|
29 |
-
)
|
30 |
-
"value",
|
31 |
-
)
|
32 |
|
33 |
-
web_page_urls_component =
|
34 |
-
dmc.MultiSelect(
|
35 |
description="Include all the reference web URLs",
|
36 |
placeholder="Enter URLs separated by commas",
|
37 |
searchable=True,
|
38 |
creatable=True,
|
39 |
-
)
|
40 |
-
"data",
|
41 |
-
)
|
42 |
|
43 |
-
text_component =
|
44 |
-
dmc.Textarea(placeholder="Write your query here", autosize=True, minRows=4, description="Any additional information that could be useful"), "value"
|
45 |
-
)
|
46 |
|
47 |
-
query_component =
|
48 |
-
dmc.Textarea(placeholder="Write your query here", autosize=True, minRows=4, required=True, description="Write your query here"), "value",
|
49 |
-
)
|
50 |
|
51 |
-
answer_component =
|
52 |
|
53 |
|
54 |
def explore_your_knowledge_base(
|
@@ -60,7 +50,7 @@ def explore_your_knowledge_base(
|
|
60 |
query: text_component,
|
61 |
) -> answer_component:
|
62 |
"""
|
63 |
-
Input your sources and let
|
64 |
This app uses embedchain.ai, which abstracts the entire process of loading and chunking datasets, creating embeddings, and storing them in a vector database.
|
65 |
Embedchain itself uses Langchain and OpenAI's ChatGPT API.
|
66 |
"""
|
@@ -76,13 +66,13 @@ def explore_your_knowledge_base(
|
|
76 |
return "Did you forget writing your query in the query box?"
|
77 |
|
78 |
if web_page_urls:
|
79 |
-
[app.add("web_page", url
|
80 |
|
81 |
if youtube_urls:
|
82 |
-
[app.add("youtube_video", url
|
83 |
|
84 |
if pdf_urls:
|
85 |
-
[app.add("pdf_file", url
|
86 |
|
87 |
if text:
|
88 |
app.add_local("text", text)
|
|
|
21 |
query_config = QueryConfig(template=PROMPT, number_documents=5, max_tokens=2000, model="gpt-4")
|
22 |
|
23 |
# Define components
|
24 |
+
openai_api_key_component = dmc.PasswordInput(
|
|
|
25 |
placeholder="API Key",
|
26 |
description="Get yours at https://platform.openai.com/account/api-keys",
|
27 |
required=True
|
28 |
+
)
|
|
|
|
|
29 |
|
30 |
+
web_page_urls_component = dmc.MultiSelect(
|
|
|
31 |
description="Include all the reference web URLs",
|
32 |
placeholder="Enter URLs separated by commas",
|
33 |
searchable=True,
|
34 |
creatable=True,
|
35 |
+
)
|
|
|
|
|
36 |
|
37 |
+
text_component = dmc.Textarea(placeholder="Write your query here", autosize=True, minRows=4, description="Any additional information that could be useful")
|
|
|
|
|
38 |
|
39 |
+
query_component = dmc.Textarea(placeholder="Write your query here", autosize=True, minRows=4, required=True, description="Write your query here")
|
|
|
|
|
40 |
|
41 |
+
answer_component = dcc.Markdown(style={"text-align": "left", "padding": "1%"}, link_target="_blank")
|
42 |
|
43 |
|
44 |
def explore_your_knowledge_base(
|
|
|
50 |
query: text_component,
|
51 |
) -> answer_component:
|
52 |
"""
|
53 |
+
Input your sources and let GPT4 find answers. Built with Fast Dash.
|
54 |
This app uses embedchain.ai, which abstracts the entire process of loading and chunking datasets, creating embeddings, and storing them in a vector database.
|
55 |
Embedchain itself uses Langchain and OpenAI's ChatGPT API.
|
56 |
"""
|
|
|
66 |
return "Did you forget writing your query in the query box?"
|
67 |
|
68 |
if web_page_urls:
|
69 |
+
[app.add("web_page", url) for url in web_page_urls]
|
70 |
|
71 |
if youtube_urls:
|
72 |
+
[app.add("youtube_video", url) for url in youtube_urls]
|
73 |
|
74 |
if pdf_urls:
|
75 |
+
[app.add("pdf_file", url) for url in pdf_urls]
|
76 |
|
77 |
if text:
|
78 |
app.add_local("text", text)
|