Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from functools import lru_cache
|
|
| 10 |
from bs4 import BeautifulSoup
|
| 11 |
import torch
|
| 12 |
import gradio as gr
|
| 13 |
-
from transformers import
|
| 14 |
from huggingface_hub import InferenceClient
|
| 15 |
|
| 16 |
import logging
|
|
@@ -147,6 +147,7 @@ def model_inference(
|
|
| 147 |
max_new_tokens,
|
| 148 |
repetition_penalty,
|
| 149 |
top_p,
|
|
|
|
| 150 |
):
|
| 151 |
logger.debug(f"Starting model inference with user prompt: {user_prompt}, chat history: {chat_history}, web_search: {web_search}")
|
| 152 |
if not isinstance(user_prompt, dict):
|
|
@@ -268,6 +269,7 @@ def chat_interface(user_input, history, web_search, decoding_strategy, temperatu
|
|
| 268 |
max_new_tokens,
|
| 269 |
repetition_penalty,
|
| 270 |
top_p,
|
|
|
|
| 271 |
)
|
| 272 |
history.append((user_input["text"], response))
|
| 273 |
logger.debug(f"Updated chat history: {history}")
|
|
|
|
| 10 |
from bs4 import BeautifulSoup
|
| 11 |
import torch
|
| 12 |
import gradio as gr
|
| 13 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, AutoConfig
|
| 14 |
from huggingface_hub import InferenceClient
|
| 15 |
|
| 16 |
import logging
|
|
|
|
| 147 |
max_new_tokens,
|
| 148 |
repetition_penalty,
|
| 149 |
top_p,
|
| 150 |
+
tokenizer # Pass tokenizer as an argument
|
| 151 |
):
|
| 152 |
logger.debug(f"Starting model inference with user prompt: {user_prompt}, chat history: {chat_history}, web_search: {web_search}")
|
| 153 |
if not isinstance(user_prompt, dict):
|
|
|
|
| 269 |
max_new_tokens,
|
| 270 |
repetition_penalty,
|
| 271 |
top_p,
|
| 272 |
+
tokenizer=tokenizer # Pass tokenizer to model_inference function
|
| 273 |
)
|
| 274 |
history.append((user_input["text"], response))
|
| 275 |
logger.debug(f"Updated chat history: {history}")
|