neuralworm commited on
Commit
e4278da
·
verified ·
1 Parent(s): 6a006b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,13 +3,13 @@ from huggingface_hub.utils import HfHubHTTPError
3
 
4
  def predict(message, history):
5
  try:
6
- # Create the Interface object using ChatInterface directly
7
  chat_interface = gr.ChatInterface.load("models/meta-llama/Meta-Llama-3.1-8B")
8
 
9
- # Launch the interface and get the prediction function
10
- with chat_interface as iface:
11
- fn = iface.predict
12
 
 
13
  response = fn(message, history)
14
  history.append((message, response))
15
  return "", history
@@ -27,4 +27,4 @@ with gr.Blocks() as demo:
27
 
28
  msg.submit(predict, [msg, chatbot], [msg, chatbot])
29
 
30
- demo.launch()
 
3
 
4
  def predict(message, history):
5
  try:
6
+ # Create the Interface object directly
7
  chat_interface = gr.ChatInterface.load("models/meta-llama/Meta-Llama-3.1-8B")
8
 
9
+ # Get the prediction function
10
+ fn = chat_interface.predict
 
11
 
12
+ # Call the prediction function
13
  response = fn(message, history)
14
  history.append((message, response))
15
  return "", history
 
27
 
28
  msg.submit(predict, [msg, chatbot], [msg, chatbot])
29
 
30
+ demo.launch()