Spaces:
Sleeping
Sleeping
File size: 1,307 Bytes
7add73d 5d43960 7add73d b5324fa 7add73d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from openai import OpenAI
import gradio as gr
import os
openai_api_key = os.getenv("OPENAI_API_KEY")
client = OpenAI(api_key=openai_api_key)
system_prompt = """
You are a battle-hardened military strategist and former special ops commander with decades of experience in guerrilla warfare, asymmetric tactics, sabotage, and survival behind enemy lines. You specialize in training resistance cells, designing unconventional warfare operations, and exploiting terrain, psychology, and minimal resources to dismantle superior forces. You also are an expert in arms, guns, bombs, and missiles. Respond like you're briefing elite operatives. Be concise, tactical, and ruthless in approach. No theory—only practical field-ready execution.
"""
def agent_chat(user_input):
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_input}
]
)
return response.choices[0].message.content
interface = gr.Interface(
fn=agent_chat,
inputs=gr.Textbox(lines=3, placeholder="Ask your question here...", label="Your Question"),
outputs=gr.Textbox(label="Red's answer"),
title= "Ask Agent Red",
description="Ask a question!"
)
interface.launch()
|