omlakhani commited on
Commit
8016be9
1 Parent(s): b6747af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import os
3
- import huggingface_hub
4
  from llama_index import GPTSimpleVectorIndex
5
  from langchain.agents import ZeroShotAgent, AgentExecutor
6
  from langchain.agents import Tool
@@ -8,11 +8,12 @@ from langchain import OpenAI, LLMChain
8
 
9
  os.environ['OPENAI_API_KEY'] = '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'
10
 
11
- model_path = "omlakhani/endoai"
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
 
 
1
  import gradio as gr
2
  import os
3
+ import boto3
4
  from llama_index import GPTSimpleVectorIndex
5
  from langchain.agents import ZeroShotAgent, AgentExecutor
6
  from langchain.agents import Tool
 
8
 
9
  os.environ['OPENAI_API_KEY'] = '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'
10
 
11
+ s3 = boto3.resource('s3')
12
+ bucket_name = "notesinendocrinology"
13
+ bucket = s3.Bucket(bucket_name)
14
+ for obj in bucket.objects.filter(Prefix="comboindex.json"):
15
+ combo_index_path = obj.key
16
+ bucket.download_file(combo_index_path, "comboindex.json")
17
 
18
  index = GPTSimpleVectorIndex.load_from_disk('comboindex.json')
19