Spaces:
Runtime error
Runtime error
Update app.py
Browse files12344563 unmodified lines1011121415161713141516171820192220212223272824252627282930343132363334353637383943444540414216 unmodified lines59606168627063import gradio as grfrom huggingface_hub import InferenceClient
def respond( message, history: list[dict[str, str]],3 unmodified lines top_p, hf_token: gr.OAuthToken,): """ For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference """ client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b") client = InferenceClient( token=hf_token.token, model="mradermacher/DeepHat-V1-7B-GGUF" # <-- Modelo correto )
messages = [{"role": "system", "content": system_message}]
messages.extend(history)
messages.append({"role": "user", "content": message})
response = ""
for message in client.chat_completion( messages, for msg in client.chat_completion( messages=messages, max_tokens=max_tokens, stream=True, temperature=temperature, top_p=top_p, ): choices = message.choices choices = msg.choices token = "" if len(choices) and choices[0].delta.content: if len(choices) and choices[0].delta and choices[0].delta.content: token = choices[0].delta.content
response += token yield response
"""For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface"""chatbot = gr.ChatInterface( respond, type="messages",16 unmodified lines gr.LoginButton() chatbot.render()
if __name__ == "__main__": demo.launch() demo.launch()app.py+9-16