import gradio as gr import requests # Define the function to interact with the API def generate_content(text): url = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=AIzaSyAflU5a8T3dCuIrkql737ZQtqWdrPmo0ts' headers = {'Content-Type': 'application/json'} data = { "contents": [ { "parts": [ { "text": text } ] } ] } response = requests.post(url, headers=headers, json=data) if response.status_code == 200: return response.json() # You can customize this to return specific parts of the response else: return f"Error: {response.status_code} - {response.text}" # Create a Gradio interface iface = gr.Interface( fn=generate_content, inputs="text", outputs="json", title="AI Content Generator", description="Enter a prompt to generate content using the CITIBANK DEMO BUSINESS INC CHAT BOT" ) # Launch the Gradio app iface.launch()