CoolFace
Apppublic

logisticsrumah/Assistmanager

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
app.py25 linesDownload Raw Back to root
1import gradio as gr2import google.generativeai as genai3 4genai.configure(api_key="AIzaSyCLwM1hu_a-UgjBrXq7JCg-hGbvs6j-nhA")5model = genai.GenerativeModel('gemini-2.0-flash')6 7def chat(prompt):8    if not prompt:9        return "Please enter a question."10    try:11        response = model.generate_content(prompt)12        return response.text13    except Exception as e:14        return f"Status: {str(e)}"15 16demo = gr.Interface(17    fn=chat,18    inputs=gr.Textbox(label="Input", placeholder="Type here..."),19    outputs="text",20    title="Gemini AI App"21)22 23if __name__ == "__main__":24    demo.launch()25