autogpt2 / app.py
seawolf2357's picture
Deploy from GitHub repository
3382f47 verified
import gradio as gr
# Function to simulate AutoGPT behavior
def run_autogpt(prompt, api_key):
if not api_key:
return "Error: API key is required. Please provide a valid API key to use AutoGPT."
# Simulate processing the prompt
response = f"AutoGPT response to: '{prompt}' (this is a simulated response)"
return response
# Gradio interface setup
def main():
with gr.Blocks() as demo:
gr.Markdown("# AutoGPT Gradio Interface\nThis app demonstrates the capabilities of AutoGPT.\n\n### Instructions:\n1. Enter your prompt in the text box.\n2. Provide your API key to access AutoGPT functionality.\n3. Click 'Run' to see the response from AutoGPT.")
with gr.Row():
api_key = gr.Textbox(label="API Key", placeholder="Enter your API key here", type="password")
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
run_button = gr.Button("Run")
output = gr.Textbox(label="Output")
run_button.click(run_autogpt, inputs=[prompt, api_key], outputs=output)
return demo
if __name__ == "__main__":
main().launch()