shibanovp commited on
Commit
e92c8bf
1 Parent(s): 1cefb16

refactor: lint app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,6 +1,5 @@
1
  from functools import cache
2
  import os
3
- import time
4
  import gradio as gr
5
  from langchain.llms import OpenAI
6
  from langchain.chains.summarize import load_summarize_chain
@@ -33,10 +32,13 @@ def split_documents(docs, length_function, chunk_size=400):
33
 
34
 
35
  def summarize_docs(llm, docs):
36
- llm = OpenAI(temperature=temperature, openai_api_key=openai_api_key, model_name=model_name)
 
 
37
  chain = load_summarize_chain(llm, chain_type="map_reduce")
38
  return chain.run(docs)
39
 
 
40
  class MdnaQA:
41
  def __init__(self, llm, docs):
42
  self.docs = docs
@@ -49,7 +51,6 @@ class MdnaQA:
49
  return self.chain.run(input_documents=input_documents, question=question)
50
 
51
 
52
-
53
  filename = "2023-05-12_2023_q1_goog_mdna.txt"
54
  loader = TextLoader(filename)
55
  documents = loader.load()
 
1
  from functools import cache
2
  import os
 
3
  import gradio as gr
4
  from langchain.llms import OpenAI
5
  from langchain.chains.summarize import load_summarize_chain
 
32
 
33
 
34
  def summarize_docs(llm, docs):
35
+ llm = OpenAI(
36
+ temperature=temperature, openai_api_key=openai_api_key, model_name=model_name
37
+ )
38
  chain = load_summarize_chain(llm, chain_type="map_reduce")
39
  return chain.run(docs)
40
 
41
+
42
  class MdnaQA:
43
  def __init__(self, llm, docs):
44
  self.docs = docs
 
51
  return self.chain.run(input_documents=input_documents, question=question)
52
 
53
 
 
54
  filename = "2023-05-12_2023_q1_goog_mdna.txt"
55
  loader = TextLoader(filename)
56
  documents = loader.load()