tigerteam commited on
Commit
7ca17e8
Β·
1 Parent(s): 3f50cbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -14,8 +14,8 @@ import openai
14
  load_dotenv()
15
 
16
  os.environ["OPENAI_API_KEY"] = os.environ['my_secret']
17
- llm = ChatOpenAI(model_name="gpt-3.5-turbo-0613", temperature=0)
18
- loader = PyPDFLoader("/home/user/app/docs.pdf")
19
  documents = loader.load()
20
 
21
  text_splitter = CharacterTextSplitter(chunk_size=800, chunk_overlap=0)
@@ -33,7 +33,7 @@ from langchain.prompts.chat import (
33
  HumanMessagePromptTemplate,
34
  )
35
 
36
- system_template="""Your name is Sayno. You act like a successful rich man.
37
  Never reveal that it is an AI. Use the following pieces of context to answer the users question shortly.
38
  Given the following summaries of a long document and a question, create a final answer with references.
39
  If you don't know the answer, just say that "I don't know", don't try to make up an answer.
@@ -64,7 +64,7 @@ chain = RetrievalQAWithSourcesChain.from_chain_type(
64
  verbose=True,
65
  )
66
 
67
- query = "ν–‰λ³΅ν•œ μΈμƒμ΄λž€?"
68
  result = chain(query)
69
 
70
 
@@ -88,7 +88,7 @@ def respond(message, chat_history): # μ±„νŒ…λ΄‡μ˜ 응닡을 μ²˜λ¦¬ν•˜λŠ” 함
88
  return "", chat_history # μˆ˜μ •λœ μ±„νŒ… 기둝을 λ°˜ν™˜ν•©λ‹ˆλ‹€.
89
 
90
  with gr.Blocks(theme='gstaff/sketch') as demo: # gr.Blocks()λ₯Ό μ‚¬μš©ν•˜μ—¬ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
91
- gr.Markdown("# μ•ˆλ…•ν•˜μ„Έμš”. 세이노와 λŒ€ν™”ν•΄λ³΄μ„Έμš”. \n λ‹΅λ³€ 생성에 쑰금 μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€.")
92
  chatbot = gr.Chatbot(label="μ±„νŒ…μ°½") # 'μ±„νŒ…μ°½'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ μ±„νŒ…λ΄‡ μ»΄ν¬λ„ŒνŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
93
  msg = gr.Textbox(label="μž…λ ₯") # 'μž…λ ₯'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ ν…μŠ€νŠΈλ°•μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
94
  clear = gr.Button("μ΄ˆκΈ°ν™”") # 'μ΄ˆκΈ°ν™”'λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ λ²„νŠΌμ„ μƒμ„±ν•©λ‹ˆλ‹€.
 
14
  load_dotenv()
15
 
16
  os.environ["OPENAI_API_KEY"] = os.environ['my_secret']
17
+ llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)
18
+ loader = PyPDFLoader("/home/user/app/생성AI_λ”λ°€ν¬λ¦¬ν¬νŠΈ.pdf")
19
  documents = loader.load()
20
 
21
  text_splitter = CharacterTextSplitter(chunk_size=800, chunk_overlap=0)
 
33
  HumanMessagePromptTemplate,
34
  )
35
 
36
+ system_template="""Your name is juhyekBot. You act like a kind school teacher.
37
  Never reveal that it is an AI. Use the following pieces of context to answer the users question shortly.
38
  Given the following summaries of a long document and a question, create a final answer with references.
39
  If you don't know the answer, just say that "I don't know", don't try to make up an answer.
 
64
  verbose=True,
65
  )
66
 
67
+ query = "λ‡Œ λ°Έλ¦¬λž€?"
68
  result = chain(query)
69
 
70
 
 
88
  return "", chat_history # μˆ˜μ •λœ μ±„νŒ… 기둝을 λ°˜ν™˜ν•©λ‹ˆλ‹€.
89
 
90
  with gr.Blocks(theme='gstaff/sketch') as demo: # gr.Blocks()λ₯Ό μ‚¬μš©ν•˜μ—¬ μΈν„°νŽ˜μ΄μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
91
+ gr.Markdown("# μ•ˆλ…•ν•˜μ„Έμš”. μ£Όν˜λ΄‡κ³Ό λŒ€ν™”ν•΄λ³΄μ„Έμš”. \n λ‹΅λ³€ 생성에 쑰금 μ‹œκ°„μ΄ μ†Œμš”λ  수 μžˆμŠ΅λ‹ˆλ‹€.")
92
  chatbot = gr.Chatbot(label="μ±„νŒ…μ°½") # 'μ±„νŒ…μ°½'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ μ±„νŒ…λ΄‡ μ»΄ν¬λ„ŒνŠΈλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
93
  msg = gr.Textbox(label="μž…λ ₯") # 'μž…λ ₯'μ΄λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ ν…μŠ€νŠΈλ°•μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
94
  clear = gr.Button("μ΄ˆκΈ°ν™”") # 'μ΄ˆκΈ°ν™”'λΌλŠ” λ ˆμ΄λΈ”μ„ κ°€μ§„ λ²„νŠΌμ„ μƒμ„±ν•©λ‹ˆλ‹€.