Vion IA
Ask me anything and I'll provide helpful and truthful answers from an outside perspective on humanity.
What is the meaning of life?
Explain quantum physics simply
How does the universe work?
from fastapi import FastAPI, HTTPException from fastapi.responses import HTMLResponse from transformers import AutoModelForCausalLM, AutoTokenizer app = FastAPI(title="Chatbot") # Load the chatbot model (DialoGPT-medium) at startup model_name = "microsoft/DialoGPT-medium" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) # Function to generate chatbot response def get_chatbot_response(user_input: str, max_length=100): if not user_input: return "Please say something!" input_ids = tokenizer.encode(user_input + tokenizer.eos_token, return_tensors="pt") chat_history_ids = model.generate( input_ids, max_length=max_length, pad_token_id=tokenizer.eos_token_id, no_repeat_ngram_size=3, do_sample=True, top_k=50, top_p=0.95, temperature=0.8 ) response = tokenizer.decode(chat_history_ids[:, input_ids.shape[-1]:][0], skip_special_tokens=True) return response.strip() # HTML, CSS, and JS for the frontend HTML_CONTENT = """
What is the meaning of life?
Explain quantum physics simply
How does the universe work?
Vion IA provides answers based on its training and design. It may make mistakes.