Sarath0x8f commited on
Commit
032ced1
·
verified ·
1 Parent(s): 1c0fddd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -14,7 +14,8 @@ load_dotenv()
14
  llm = HuggingFaceInferenceAPI(
15
  # model_name="meta-llama/Meta-Llama-3-8B-Instruct",
16
  model_name="mistralai/Mixtral-8x7B-Instruct-v0.1",
17
- token=os.getenv("TOKEN")
 
18
  )
19
 
20
  parser = LlamaParse(api_key=os.getenv("LLAMA_INDEX_API"), result_type='markdown')
@@ -46,7 +47,7 @@ def respond(message, history):
46
  # for chr in bot_message:
47
  # output += chr
48
  # yield output
49
- print(f"\n{datetime.now()}::message --> {str(bot_message)}\n")
50
  return str(bot_message)
51
  except Exception as e:
52
  if e == "'NoneType' object has no attribute 'as_query_engine'":
@@ -62,10 +63,10 @@ with gr.Blocks() as demo:
62
  clear = gr.ClearButton()
63
  btn = gr.Button("Submit", variant='primary')
64
  output = gr.Text(label='Vector Index')
65
- with gr.Column(scale=2):
66
  gr.ChatInterface(fn=respond,
67
  chatbot=gr.Chatbot(height=500),
68
- textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
69
  # examples=["summarize the document"]
70
  )
71
 
@@ -76,4 +77,4 @@ with gr.Blocks() as demo:
76
 
77
  # Launch the demo with public link option
78
  if __name__ == "__main__":
79
- demo.launch(share=True)
 
14
  llm = HuggingFaceInferenceAPI(
15
  # model_name="meta-llama/Meta-Llama-3-8B-Instruct",
16
  model_name="mistralai/Mixtral-8x7B-Instruct-v0.1",
17
+ token=os.getenv("TOKEN"),
18
+ model_config={'protected_namespaces': ()}
19
  )
20
 
21
  parser = LlamaParse(api_key=os.getenv("LLAMA_INDEX_API"), result_type='markdown')
 
47
  # for chr in bot_message:
48
  # output += chr
49
  # yield output
50
+ print(f"\n{datetime.now()}:: {message} --> {str(bot_message)}\n")
51
  return str(bot_message)
52
  except Exception as e:
53
  if e == "'NoneType' object has no attribute 'as_query_engine'":
 
63
  clear = gr.ClearButton()
64
  btn = gr.Button("Submit", variant='primary')
65
  output = gr.Text(label='Vector Index')
66
+ with gr.Column(scale=3):
67
  gr.ChatInterface(fn=respond,
68
  chatbot=gr.Chatbot(height=500),
69
+ textbox=gr.Textbox(placeholder="Ask me questions on given document!", container=False, scale=7),
70
  # examples=["summarize the document"]
71
  )
72
 
 
77
 
78
  # Launch the demo with public link option
79
  if __name__ == "__main__":
80
+ demo.launch()