HarshvardhanCn01 commited on
Commit
87ccdf6
·
verified ·
1 Parent(s): c39c723

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ os.environ['GROQ_API_KEY'] = "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"
3
+ from groq import Groq
4
+
5
+ client = Groq()
6
+
7
+ def chatbot(prompt):
8
+ chat_completion = client.chat.completions.create(
9
+ messages=[
10
+ {
11
+ "role": "user",
12
+ "content":prompt,
13
+ }
14
+ ],
15
+ model="llama3-8b-8192",
16
+ stream=False,
17
+ )
18
+ return chat_completion.choices[0].message.content
19
+ import gradio as gr
20
+ gradio_app = gr.Interface(
21
+ chatbot,
22
+ inputs=['text'],
23
+ outputs=['text'],
24
+ title="Harsh's Chatbot",
25
+ )
26
+ if __name__ == "__main__":
27
+ gradio_app.launch(debug=True)