import gradio as gr import os from groq import Groq # Initialize Groq client client = Groq(api_key=os.getenv("GROQ_API_KEY")) # Conversation memory conversation_history = [ { "role": "system", "content": "You are an expert in storyboarding. Provide structured and insightful responses." } ] def chat_with_bot(user_input, history): history = history or conversation_history history.append({"role": "user", "content": user_input}) completion = client.chat.completions.create( model="llama-3.3-70b-versatile", messages=history, temperature=1, max_tokens=1024, top_p=1, stream=False, ) assistant_msg = completion.choices[0].message.content history.append({"role": "assistant", "content": assistant_msg}) return history, history def generate_storyboard(scenario): if not scenario.strip(): return "Please provide a scenario." messages = [ {"role": "system", "content": "Generate a 6-scene storyboard in table form."}, {"role": "user", "content": scenario} ] completion = client.chat.completions.create( model="llama-3.3-70b-versatile", messages=messages, temperature=1, max_tokens=1024, ) return completion.choices[0].message.content TITLE = """