Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ log_file = Path("logs/") / f"data_{uuid.uuid4()}.json"
|
|
39 |
log_folder = log_file.parent
|
40 |
|
41 |
scheduler = CommitScheduler(
|
42 |
-
repo_id="document-qna-chroma-anyscale-
|
43 |
repo_type="dataset",
|
44 |
folder_path=log_folder,
|
45 |
path_in_repo="data",
|
@@ -65,6 +65,7 @@ Here are some documents that are relevant to the question.
|
|
65 |
```
|
66 |
"""
|
67 |
|
|
|
68 |
def predict(user_input):
|
69 |
|
70 |
relevant_document_chunks = retriever.invoke(user_input)
|
@@ -111,7 +112,8 @@ def predict(user_input):
|
|
111 |
|
112 |
textbox = gr.Textbox(placeholder="Enter your query here", lines=6)
|
113 |
|
114 |
-
|
|
|
115 |
inputs=textbox, fn=predict, outputs="text",
|
116 |
title="AMA on Tesla 10-K statements",
|
117 |
description="This web API presents an interface to ask questions on contents of the Tesla 10-K reports for the period 2019 - 2023.",
|
@@ -120,11 +122,9 @@ interface = gr.Interface(
|
|
120 |
["Summarize the Management Discussion and Analysis section of the 2021 report in 50 words.", ""],
|
121 |
["What was the company's debt level in 2020?", ""],
|
122 |
["Identify 5 key risks identified in the 2019 10k report? Respond with bullet point summaries.", ""]
|
123 |
-
]
|
|
|
124 |
)
|
125 |
|
126 |
-
|
127 |
-
interface.launch()
|
128 |
-
|
129 |
-
demo.queue(concurrency_count=16)
|
130 |
demo.launch()
|
|
|
39 |
log_folder = log_file.parent
|
40 |
|
41 |
scheduler = CommitScheduler(
|
42 |
+
repo_id="document-qna-chroma-anyscale-logs",
|
43 |
repo_type="dataset",
|
44 |
folder_path=log_folder,
|
45 |
path_in_repo="data",
|
|
|
65 |
```
|
66 |
"""
|
67 |
|
68 |
+
# Define the predict function that runs when 'Submit' is clicked or when a API request is made
|
69 |
def predict(user_input):
|
70 |
|
71 |
relevant_document_chunks = retriever.invoke(user_input)
|
|
|
112 |
|
113 |
textbox = gr.Textbox(placeholder="Enter your query here", lines=6)
|
114 |
|
115 |
+
# Create the interface
|
116 |
+
demo = gr.Interface(
|
117 |
inputs=textbox, fn=predict, outputs="text",
|
118 |
title="AMA on Tesla 10-K statements",
|
119 |
description="This web API presents an interface to ask questions on contents of the Tesla 10-K reports for the period 2019 - 2023.",
|
|
|
122 |
["Summarize the Management Discussion and Analysis section of the 2021 report in 50 words.", ""],
|
123 |
["What was the company's debt level in 2020?", ""],
|
124 |
["Identify 5 key risks identified in the 2019 10k report? Respond with bullet point summaries.", ""]
|
125 |
+
],
|
126 |
+
concurrency_limit=16
|
127 |
)
|
128 |
|
129 |
+
demo.queue()
|
|
|
|
|
|
|
130 |
demo.launch()
|