dhuynh95 commited on
Commit
7dcba46
1 Parent(s): d8cb146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -11
app.py CHANGED
@@ -31,14 +31,6 @@ with gr.Blocks() as demo:
31
  gr.Markdown("<p align='center'><img src='https://yt3.googleusercontent.com/5ONImZvpa9_hYK12Xek2E2JLzRc732DWsZMX2F-AZ1cTutTQLBuAmcEtFwrCgypqJncl5HrV2w=s900-c-k-c0x00ffffff-no-rj' height='50' width='95'></p>")
32
  gr.Markdown("<p align='center' style='font-size: 20px;'>Hi! I am Andrew HuberChat, a chatbot trained to answer neurobiology.</p>")
33
  gr.Markdown("<p align='center' style='font-size: 20px;'>Disclaimer: this is a fan-made project to highlight the work of Andrew Huberman. To support this project, please have a look at <a href='https://hubermanlab.com/'>Huberman Lab</a>.</p>")
34
- with gr.Row().style():
35
- with gr.Column(scale=1.0):
36
- openai_api_key = gr.Textbox(
37
- show_label=False,
38
- placeholder="Set your OpenAI API key here.",
39
- lines=1,
40
- type="password"
41
- ).style(container=False)
42
  with gr.Row().style():
43
  with gr.Column(scale=0.85):
44
  msg = gr.Textbox(
@@ -60,9 +52,7 @@ with gr.Blocks() as demo:
60
  clear = gr.Button("Clear")
61
 
62
  def respond(openai_api_key, message, chat_history):
63
- if not openai_api_key:
64
- return "No OpenAI key provided, please provide one.", chat_history
65
- os.environ["OPENAI_API_KEY"] = openai_api_key
66
  index = load_index_from_storage(storage_context)
67
  query_engine = index.as_query_engine(similarity_top_k=3)
68
  response = query_engine.query(message)
 
31
  gr.Markdown("<p align='center'><img src='https://yt3.googleusercontent.com/5ONImZvpa9_hYK12Xek2E2JLzRc732DWsZMX2F-AZ1cTutTQLBuAmcEtFwrCgypqJncl5HrV2w=s900-c-k-c0x00ffffff-no-rj' height='50' width='95'></p>")
32
  gr.Markdown("<p align='center' style='font-size: 20px;'>Hi! I am Andrew HuberChat, a chatbot trained to answer neurobiology.</p>")
33
  gr.Markdown("<p align='center' style='font-size: 20px;'>Disclaimer: this is a fan-made project to highlight the work of Andrew Huberman. To support this project, please have a look at <a href='https://hubermanlab.com/'>Huberman Lab</a>.</p>")
 
 
 
 
 
 
 
 
34
  with gr.Row().style():
35
  with gr.Column(scale=0.85):
36
  msg = gr.Textbox(
 
52
  clear = gr.Button("Clear")
53
 
54
  def respond(openai_api_key, message, chat_history):
55
+
 
 
56
  index = load_index_from_storage(storage_context)
57
  query_engine = index.as_query_engine(similarity_top_k=3)
58
  response = query_engine.query(message)