Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from huggingface_hub import InferenceClient | |
| client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.2") | |
| def chat(message, history): | |
| full_prompt = "" | |
| for user, bot in history: | |
| full_prompt += f"Usuario: {user}\nAsistente: {bot}\n" | |
| full_prompt += f"Usuario: {message}\nAsistente:" | |
| result = client.text_generation( | |
| full_prompt, | |
| max_new_tokens=300, | |
| temperature=0.7, | |
| top_p=0.9 | |
| ) | |
| return result.strip() | |
| gr.ChatInterface(fn=chat).launch() | |