neuralworm commited on
Commit
ae40801
·
verified ·
1 Parent(s): ee0b947

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -3,11 +3,11 @@ from huggingface_hub.utils import HfHubHTTPError
3
 
4
  def predict(message, history):
5
  try:
6
- # Define the model interface directly using the load method
7
- chat_interface = gr.ChatInterface.load("models/meta-llama/Meta-Llama-3.1-8B")
8
 
9
- # Use the interface to get predictions
10
- response = chat_interface(message, history)
11
  history.append((message, response))
12
  return "", history
13
 
@@ -23,5 +23,3 @@ with gr.Blocks() as demo:
23
  clear = gr.ClearButton([msg, chatbot])
24
 
25
  msg.submit(predict, [msg, chatbot], [msg, chatbot])
26
-
27
- demo.launch()
 
3
 
4
  def predict(message, history):
5
  try:
6
+ # Load the model interface directly using the load method
7
+ chat_interface = gr.Interface.load("models/meta-llama/Meta-Llama-3.1-8B")
8
 
9
+ # Get the prediction using the correct method call
10
+ response = chat_interface.predict(message)
11
  history.append((message, response))
12
  return "", history
13
 
 
23
  clear = gr.ClearButton([msg, chatbot])
24
 
25
  msg.submit(predict, [msg, chatbot], [msg, chatbot])