Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,15 @@ from langchain import OpenAI, LLMChain
|
|
8 |
|
9 |
os.environ['OPENAI_API_KEY'] = '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'
|
10 |
|
11 |
-
model_path = "
|
12 |
hf_model = huggingface_hub.HfApi()
|
13 |
-
|
14 |
-
combo_index_path = [
|
15 |
-
hf_model.download_to_disk(combo_index_path, overwrite=True)
|
|
|
16 |
index = GPTSimpleVectorIndex.load_from_disk('comboindex.json')
|
17 |
|
|
|
18 |
def querying_db(query: str):
|
19 |
response = index.query(query)
|
20 |
return response
|
@@ -57,6 +59,7 @@ def get_answer(query_string):
|
|
57 |
def qa_app(query):
|
58 |
return get_answer(query)
|
59 |
|
|
|
60 |
inputs = gr.inputs.Textbox(label="Enter your question:")
|
61 |
output = gr.outputs.Textbox(label="Answer:")
|
62 |
iface = gr.Interface(fn=qa_app, inputs=inputs, outputs=output, title="Endo AI : Endocrine answering app by Dr. Om J Lakhani")
|
|
|
8 |
|
9 |
os.environ['OPENAI_API_KEY'] = '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'
|
10 |
|
11 |
+
model_path = "user/endo-ai"
|
12 |
hf_model = huggingface_hub.HfApi()
|
13 |
+
objects = hf_model.list_objects(model_path, "main")
|
14 |
+
combo_index_path = [obj.path for obj in objects["objects"] if obj.path.endswith("comboindex.json")][0]
|
15 |
+
hf_model.download_to_disk(combo_index_path, "comboindex.json", overwrite=True)
|
16 |
+
|
17 |
index = GPTSimpleVectorIndex.load_from_disk('comboindex.json')
|
18 |
|
19 |
+
|
20 |
def querying_db(query: str):
|
21 |
response = index.query(query)
|
22 |
return response
|
|
|
59 |
def qa_app(query):
|
60 |
return get_answer(query)
|
61 |
|
62 |
+
|
63 |
inputs = gr.inputs.Textbox(label="Enter your question:")
|
64 |
output = gr.outputs.Textbox(label="Answer:")
|
65 |
iface = gr.Interface(fn=qa_app, inputs=inputs, outputs=output, title="Endo AI : Endocrine answering app by Dr. Om J Lakhani")
|