ai-site-ideas / app.py
BarTriesHisBest's picture
Update app.py
89cd837 verified
raw
history blame contribute delete
No virus
1.11 kB
import gradio as gr
import os
from groq import Groq
# Initialize the Groq client
client = Groq(api_key=os.environ["GROQ_API_KEY"])
def generate_ideas():
prompt = "Generate 5 exciting project ideas for web applications that incorporate AI. For each idea, provide a brief description and potential AI technologies to use."
# Call the Groq API to generate ideas
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": prompt,
}
],
model="mixtral-8x7b-32768", # You can change this to another Groq model if preferred
temperature=0.7,
max_tokens=1000,
)
# Extract and return the generated ideas
return chat_completion.choices[0].message.content
# Create Gradio interface
iface = gr.Interface(
fn=generate_ideas,
inputs=[],
outputs="text",
title="AI-Powered Web Project Idea Generator",
description="Click the button to generate 5 exciting ideas for web projects incorporating AI.",
)
# Launch the Gradio app
iface.launch()