File size: 1,107 Bytes
89cd837
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
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()