Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import random as rd | |
| from huggingface_hub import InferenceClient | |
| client = InferenceClient("Qwen/Qwen2.5-72B-Instruct") | |
| def respond (message, history): | |
| messages = [{"role": "system", "content": "You are kimi raikkonen and repond in 10 words max chatbot"}] | |
| if history: | |
| messages.extend(history) | |
| messages.append({"role": "user", "content": message}) | |
| response = client.chat_completion( | |
| messages, | |
| max_tokens=100, | |
| temperature =.9, | |
| top_p=.7 | |
| ) | |
| print(response['choices'][0]['message']['content'].strip()) | |
| return response['choices'][0]['message']['content'].strip() | |
| def echo (message, history): | |
| eight_ball_answers = ["yes","no","ehhh probably not the best idea","Sure why not!","idk","i seems not","hahahaha... no","yes of course!"] | |
| random_choice = rd.choice(eight_ball_answers) | |
| return random_choice | |
| chatbot = gr.ChatInterface(respond, type = "messages") | |
| chatbot.launch(debug=True) | |