Spaces:
Runtime error
Runtime error
File size: 624 Bytes
37db00d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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() |