ewaste-chatbot / app.py
tomchen86's picture
Update space
fa62323
raw
history blame contribute delete
653 Bytes
import gradio as gr
from transformers import pipeline
# Load a lightweight text-generation model for free usage
generator = pipeline("text-generation", model="tiiuae/falcon-rw-1b")
# Define chatbot function
def chatbot(message, history):
# Combine message history for context
prompt = message
result = generator(prompt, max_new_tokens=100, do_sample=True, temperature=0.7)[0]['generated_text']
return result.strip()
# Launch Gradio chat interface
gr.ChatInterface(
fn=chatbot,
title="E-Waste Chatbot",
description="Ask questions about electronic waste, recycling, or environmental impact!",
theme="compact"
).launch()