iamsolankiamit commited on
Commit
7082a57
·
verified ·
1 Parent(s): 325ed48

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +24 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import gradio as gr
3
+ from groq import Groq
4
+ import os
5
+ from dotenv import load_dotenv
6
+
7
+ load_dotenv()
8
+
9
+ groq = Groq(api_key=os.getenv("GROQ_API_KEY"))
10
+
11
+ def random_response(message, history):
12
+ return random.choice(["Yes", "No"])
13
+
14
+ def chat_completion(message, history):
15
+ response = groq.chat.completions.create(
16
+ model="meta-llama/llama-4-scout-17b-16e-instruct",
17
+ messages=[{"role": "user", "content": message}],
18
+ )
19
+ return response.choices[0].message.content
20
+
21
+ demo = gr.ChatInterface(chat_completion, title="LLAMA 3.1", description="Ask the bot a question", theme="soft")
22
+
23
+ if __name__ == "__main__":
24
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ groq
2
+ gradio
3
+ load_dotenv