import gradio as gr from transformers import pipeline # IBM Granite model model_name = "ibm-granite/granite-3.2-2b-instruct" generator = pipeline("text-generation", model=model_name) def smart_city_assistant(prompt): response = generator(prompt, max_new_tokens=200, do_sample=True, temperature=0.7) return response[0]['generated_text'] iface = gr.Interface( fn=smart_city_assistant, inputs=gr.Textbox(lines=3, placeholder="Ask about smart city, governance, eco tips..."), outputs="text", title="🌱 Sustainable Smart City Assistant", description="Powered by IBM Granite LLM" ) iface.launch()