Adrian Cowham commited on
Commit
f56f728
β€’
1 Parent(s): c5860c1

initial commit:

Browse files
Files changed (2) hide show
  1. README.md +3 -3
  2. src/app.py +9 -9
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: Pyrocene
3
- emoji: πŸŒ–
4
- colorFrom: green
5
- colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.40.1
8
  app_file: src/app.py
 
1
  ---
2
  title: Pyrocene
3
+ emoji: πŸ“™
4
+ colorFrom: orange
5
+ colorTo: orange
6
  sdk: gradio
7
  sdk_version: 3.40.1
8
  app_file: src/app.py
src/app.py CHANGED
@@ -23,8 +23,8 @@ K = 5
23
  USE_VERBOSE = True
24
  API_KEY = os.environ["OPENAI_API_KEY"]
25
  system_template = """
26
- The context below contains excerpts from 'Design by Fire,' by Emily Elizabeth Schlickman and Brett Milligan. You must only use the information in the context below to formulate your response. If there is not enough information to formulate a response, you must respond with
27
- "I'm sorry, but I can't find the answer to your question in, the book Design by Fire."
28
 
29
  Here is the context:
30
  {context}
@@ -43,7 +43,7 @@ class AnswerConversationBufferMemory(ConversationBufferMemory):
43
  return super(AnswerConversationBufferMemory, self).save_context(inputs,{'response': outputs['answer']})
44
 
45
  def getretriever():
46
- with open("./resources/design-by-fire.pdf", 'rb') as uploaded_file:
47
  try:
48
  file = read_file(uploaded_file)
49
  except Exception as e:
@@ -106,15 +106,15 @@ with gr.Blocks() as block:
106
  with gr.Row():
107
  with gr.Column(scale=0.75):
108
  with gr.Row():
109
- gr.Markdown("<h1>Design by Fire</h1>")
110
  with gr.Row():
111
- gr.Markdown("by Emily Elizabeth Schlickman and Brett Milligan")
112
  chatbot = gr.Chatbot(elem_id="chatbot").style(height=600)
113
 
114
  with gr.Row():
115
  message = gr.Textbox(
116
  label="",
117
- placeholder="Design by Fire",
118
  lines=1,
119
  )
120
  with gr.Row():
@@ -129,11 +129,11 @@ with gr.Blocks() as block:
129
  with gr.Column(scale=0.25):
130
  with gr.Row():
131
  gr.Markdown("<h1><center>Suggestions</center></h1>")
132
- ex1 = gr.Button(value="What are the main factors and trends discussed in the book that contribute to the changing behavior of wildfires?", variant="primary")
133
  ex1.click(getanswer, inputs=[chain_state, ex1, state], outputs=[chatbot, state, message])
134
- ex2 = gr.Button(value="How does the book explore the relationship between fire and different landscapes, such as wilderness and urban areas?", variant="primary")
135
  ex2.click(getanswer, inputs=[chain_state, ex2, state], outputs=[chatbot, state, message])
136
- ex3 = gr.Button(value="What are the three approaches to designing with fire that the book presents?", variant="primary")
137
  ex3.click(getanswer, inputs=[chain_state, ex3, state], outputs=[chatbot, state, message])
138
 
139
  block.launch(debug=True)
 
23
  USE_VERBOSE = True
24
  API_KEY = os.environ["OPENAI_API_KEY"]
25
  system_template = """
26
+ The context below contains excerpts from 'Japan,' by DK Eyewitness. You must only use the information in the context below to formulate your response. If there is not enough information to formulate a response, you must respond with
27
+ "I'm sorry, but I can't find the answer to your question in, the book Japan."
28
 
29
  Here is the context:
30
  {context}
 
43
  return super(AnswerConversationBufferMemory, self).save_context(inputs,{'response': outputs['answer']})
44
 
45
  def getretriever():
46
+ with open("./resources/DK-Eyewitness-Japan-DK-Eyewitness.pdf", 'rb') as uploaded_file:
47
  try:
48
  file = read_file(uploaded_file)
49
  except Exception as e:
 
106
  with gr.Row():
107
  with gr.Column(scale=0.75):
108
  with gr.Row():
109
+ gr.Markdown("<h1>Japan</h1>")
110
  with gr.Row():
111
+ gr.Markdown("by DK EyeWitness")
112
  chatbot = gr.Chatbot(elem_id="chatbot").style(height=600)
113
 
114
  with gr.Row():
115
  message = gr.Textbox(
116
  label="",
117
+ placeholder="Japan",
118
  lines=1,
119
  )
120
  with gr.Row():
 
129
  with gr.Column(scale=0.25):
130
  with gr.Row():
131
  gr.Markdown("<h1><center>Suggestions</center></h1>")
132
+ ex1 = gr.Button(value="Why should I go to Japan?", variant="primary")
133
  ex1.click(getanswer, inputs=[chain_state, ex1, state], outputs=[chatbot, state, message])
134
+ ex2 = gr.Button(value="What are the top attractions in Kyoto?", variant="primary")
135
  ex2.click(getanswer, inputs=[chain_state, ex2, state], outputs=[chatbot, state, message])
136
+ ex3 = gr.Button(value="What are some important customs I should know before visiting?", variant="primary")
137
  ex3.click(getanswer, inputs=[chain_state, ex3, state], outputs=[chatbot, state, message])
138
 
139
  block.launch(debug=True)