Spaces:
Sleeping
Sleeping
高橋慧 commited on
Commit ·
3a0dc06
1
Parent(s): d13dd0c
Move chromedriver to Git LFS
Browse files- OpenAITools/ExpertTools.py +4 -1
- app.py +7 -3
- requirements.txt +1 -1
OpenAITools/ExpertTools.py
CHANGED
|
@@ -19,7 +19,8 @@ import numpy as np
|
|
| 19 |
import time
|
| 20 |
#from langchain.agents import create_pandas_dataframe_agent
|
| 21 |
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 22 |
-
from langchain.llms import OpenAI
|
|
|
|
| 23 |
|
| 24 |
# APIキーの設定
|
| 25 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
|
@@ -135,6 +136,7 @@ def print_agent_results(df, Ids,
|
|
| 135 |
|
| 136 |
def search(query):
|
| 137 |
Entrez.email = os.getenv('MAIL_ADRESS')
|
|
|
|
| 138 |
handle = Entrez.esearch(db='pubmed',
|
| 139 |
sort = 'relevance',
|
| 140 |
retmax = '20',
|
|
@@ -146,6 +148,7 @@ def search(query):
|
|
| 146 |
def fetch_details(id_list):
|
| 147 |
ids = ','.join(id_list)
|
| 148 |
Entrez.email = os.getenv('MAIL_ADRESS')
|
|
|
|
| 149 |
handle = Entrez.efetch(db = 'pubmed',
|
| 150 |
retmode = 'xml',
|
| 151 |
id = ids)
|
|
|
|
| 19 |
import time
|
| 20 |
#from langchain.agents import create_pandas_dataframe_agent
|
| 21 |
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 22 |
+
#from langchain.llms import OpenAI
|
| 23 |
+
from langchain_community.llms import OpenAI
|
| 24 |
|
| 25 |
# APIキーの設定
|
| 26 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
|
|
|
| 136 |
|
| 137 |
def search(query):
|
| 138 |
Entrez.email = os.getenv('MAIL_ADRESS')
|
| 139 |
+
#Entrez.email='sing.monotonyflower@gmail.com'
|
| 140 |
handle = Entrez.esearch(db='pubmed',
|
| 141 |
sort = 'relevance',
|
| 142 |
retmax = '20',
|
|
|
|
| 148 |
def fetch_details(id_list):
|
| 149 |
ids = ','.join(id_list)
|
| 150 |
Entrez.email = os.getenv('MAIL_ADRESS')
|
| 151 |
+
#Entrez.email = 'sing.monotonyflower@gmail.com'
|
| 152 |
handle = Entrez.efetch(db = 'pubmed',
|
| 153 |
retmode = 'xml',
|
| 154 |
id = ids)
|
app.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
from OpenAITools.ExpertTools import GetPubmedSummaryDf, generate, search
|
| 2 |
-
from llama_index.core import
|
| 3 |
from llama_index.core import Document
|
| 4 |
from llama_index.llms.groq import Groq
|
| 5 |
from llama_index.core import ServiceContext, set_global_service_context
|
| 6 |
from llama_index.llms.llama_cpp.llama_utils import messages_to_prompt, completion_to_prompt
|
|
|
|
|
|
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
#models
|
|
@@ -31,8 +33,10 @@ def getMutationEffect(cancer_name, gene_name):
|
|
| 31 |
completion_to_prompt=custom_completion_to_prompt,
|
| 32 |
messages_to_prompt=messages_to_prompt,)
|
| 33 |
#set global service context
|
| 34 |
-
ctx = ServiceContext.from_defaults(llm=llm)
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
documents = [Document(text=t) for t in abstracts[:10]]
|
| 37 |
index = SummaryIndex.from_documents(documents)
|
| 38 |
query_engine = index.as_query_engine(response_mode="tree_summarize")
|
|
|
|
| 1 |
from OpenAITools.ExpertTools import GetPubmedSummaryDf, generate, search
|
| 2 |
+
from llama_index.core import SummaryIndex
|
| 3 |
from llama_index.core import Document
|
| 4 |
from llama_index.llms.groq import Groq
|
| 5 |
from llama_index.core import ServiceContext, set_global_service_context
|
| 6 |
from llama_index.llms.llama_cpp.llama_utils import messages_to_prompt, completion_to_prompt
|
| 7 |
+
#from llama_index.settings import Settings
|
| 8 |
+
from llama_index.core import Settings
|
| 9 |
import gradio as gr
|
| 10 |
|
| 11 |
#models
|
|
|
|
| 33 |
completion_to_prompt=custom_completion_to_prompt,
|
| 34 |
messages_to_prompt=messages_to_prompt,)
|
| 35 |
#set global service context
|
| 36 |
+
#ctx = ServiceContext.from_defaults(llm=llm)
|
| 37 |
+
#ctx = Settings(llm=llm)
|
| 38 |
+
Settings.llm = llm
|
| 39 |
+
#set_global_service_context(ctx)
|
| 40 |
documents = [Document(text=t) for t in abstracts[:10]]
|
| 41 |
index = SummaryIndex.from_documents(documents)
|
| 42 |
query_engine = index.as_query_engine(response_mode="tree_summarize")
|
requirements.txt
CHANGED
|
@@ -14,7 +14,7 @@ greenlet==3.0.3
|
|
| 14 |
hpack==4.0.0
|
| 15 |
jsonpatch==1.33
|
| 16 |
langchain==0.2.2
|
| 17 |
-
langchain-community==0.2.
|
| 18 |
langchain-core==0.2.4
|
| 19 |
langchain-experimental==0.0.60
|
| 20 |
langchain-openai==0.1.8
|
|
|
|
| 14 |
hpack==4.0.0
|
| 15 |
jsonpatch==1.33
|
| 16 |
langchain==0.2.2
|
| 17 |
+
langchain-community==0.2.4
|
| 18 |
langchain-core==0.2.4
|
| 19 |
langchain-experimental==0.0.60
|
| 20 |
langchain-openai==0.1.8
|