Spaces:
Sleeping
Sleeping
Commit History
-
Create requirements.txt
Verified signature05fd020 -
Create app.py
Verified signatureimport gradio as gr from transformers import AutoModelForCausalLM, AutoTokenizer import torch # Use a smaller instruct-tuned model that runs on Hugging Face Spaces model_name = "tiiuae/falcon-7b-instruct" # Falcon-7B is lighter than Mistral # Load model and tokenizer with optimizations tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype=torch.float16, device_map="auto" # Uses available GPU/CPU ) # AI Response Function def nithin_ai(question): inputs = tokenizer(question, return_tensors="pt").input_ids.to(model.device) outputs = model.generate(inputs, max_length=200) response = tokenizer.decode(outputs[0], skip_special_tokens=True) return response # Gradio Chat Interface iface = gr.Interface( fn=nithin_ai, inputs="text", outputs="text", title="Nithin AI - Student Doubt Solver", description="Ask any question related to robotics, science, or math!" ) iface.laun…7bbea66 -
Update app.py
Verified signatureimport gradio as gr from transformers import AutoModelForCausalLM, AutoTokenizer import torch # Load a smaller model that works on Hugging Face free tier model_name = "tiiuae/falcon-7b-instruct" # Use instruct-tuned model tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype=torch.float16, device_map="cpu" # Change to "auto" if using a GPU ) def nithin_ai(question): inputs = tokenizer(question, return_tensors="pt").input_ids outputs = model.generate(inputs, max_length=200) response = tokenizer.decode(outputs[0], skip_special_tokens=True) return response # Gradio Chat Interface iface = gr.Interface( fn=nithin_ai, inputs="text", outputs="text", title="Nithin AI - Student Doubt Solver", description="Ask any question related to robotics, science, or math!" ) iface.launch()b4f9367 -
Update app.py
Verified signaturede4e92a -
Create app.py
Verified signatureimport gradio as gr from transformers import pipeline # Load the AI model (You can fine-tune later) chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-v0.1") def nithin_ai(question): response = chatbot(question, max_length=200, do_sample=True)[0]["generated_text"] return response # Gradio Chat Interface iface = gr.Interface( fn=nithin_ai, inputs="text", outputs="text", title="Nithin AI - Student Doubt Solver", description="Ask any question related to robotics, science, or math!" ) iface.launch()d363673 -
initial commit
Verified signaturede5221b -
Duplicate from gradio-templates/chatbot
Verified signatureCo-authored-by: Pete <pngwn@users.noreply.huggingface.co>9dfd693