Spaces:
Runtime error
Runtime error
Commit
·
71c240e
1
Parent(s):
feb3edf
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
from indexes import create_indexes
|
4 |
from conversation import create_conversation
|
|
|
|
|
|
|
|
|
5 |
|
6 |
with gr.Blocks() as demo:
|
7 |
with gr.Row():
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
with gr.Row():
|
17 |
with gr.Column():
|
18 |
file = gr.components.File(
|
@@ -22,8 +26,6 @@ with gr.Blocks() as demo:
|
|
22 |
with gr.Row():
|
23 |
upload = gr.components.Button(
|
24 |
value='Upload', variant='primary')
|
25 |
-
index_clear_btn = gr.components.Button(
|
26 |
-
value='Clear', variant='stop')
|
27 |
label = gr.components.Textbox(label='Status of uploaded file')
|
28 |
|
29 |
chatbot = gr.Chatbot(label='Talk to the Document')
|
@@ -31,11 +33,15 @@ with gr.Blocks() as demo:
|
|
31 |
clear = gr.ClearButton([msg, chatbot])
|
32 |
|
33 |
upload.click(create_indexes, [
|
34 |
-
file,
|
35 |
-
index_clear_btn.click(clear_indexes, [
|
36 |
-
|
37 |
-
msg.submit(create_conversation, [msg, chatbot,
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
if __name__ == '__main__':
|
41 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
+
from indexes import create_indexes #,clear_indexes
|
4 |
from conversation import create_conversation
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
load_dotenv()
|
7 |
+
|
8 |
+
openai_api_key=os.getenv('OPENAI_API_KEY')
|
9 |
|
10 |
with gr.Blocks() as demo:
|
11 |
with gr.Row():
|
12 |
+
collection_name = gr.components.Textbox(
|
13 |
+
label='Document name')
|
14 |
+
# pinecone_environment = gr.components.Textbox(
|
15 |
+
# label='Pinecone environment')
|
16 |
+
# pinecone_index_name = gr.components.Textbox(
|
17 |
+
# label='Pinecone index name')
|
18 |
+
# openai_api_key = gr.components.Textbox(
|
19 |
+
# label='Openai API key', type='password')
|
20 |
with gr.Row():
|
21 |
with gr.Column():
|
22 |
file = gr.components.File(
|
|
|
26 |
with gr.Row():
|
27 |
upload = gr.components.Button(
|
28 |
value='Upload', variant='primary')
|
|
|
|
|
29 |
label = gr.components.Textbox(label='Status of uploaded file')
|
30 |
|
31 |
chatbot = gr.Chatbot(label='Talk to the Document')
|
|
|
33 |
clear = gr.ClearButton([msg, chatbot])
|
34 |
|
35 |
upload.click(create_indexes, [
|
36 |
+
file,collection_name], [label])
|
37 |
+
# index_clear_btn.click(clear_indexes, [
|
38 |
+
# pinecone_api_key, pinecone_environment, pinecone_index_name], [label, file])
|
39 |
+
msg.submit(create_conversation, [msg, chatbot, collection_name], [msg, chatbot])
|
40 |
+
|
41 |
+
# def same_auth((username, password)):
|
42 |
+
# username: ('LawGPT0','')
|
43 |
+
# password: ('GPT089!')
|
44 |
+
# return username == password
|
45 |
|
46 |
+
#if __name__ == '__main__':
|
47 |
+
demo.launch(auth=[("admin", "pass1234"),("razzan", "rosli")])
|