File size: 623 Bytes
c09287f
1d1c863
 
ce88cc6
a6761a6
ce88cc6
a6761a6
 
1c637d0
 
 
 
 
 
 
 
a6761a6
 
 
 
 
 
 
 
ce88cc6
 
a6761a6
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
import os
os.environ['GROQ_API_KEY'] = "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"
from groq import Groq

client = Groq()

def chatbot(prompt):
  chat_completion = client.chat.completions.create(
      messages=[
          {
              "role": "user",
              "content":prompt,
          }
      ],
      model="llama3-8b-8192",
      stream=False,
  )
  return chat_completion.choices[0].message.content
import gradio as gr
gradio_app = gr.Interface(
    chatbot,
    inputs=['text'],
    outputs=['text'],
    title="Harsh's Chatbot",
)
if __name__ == "__main__":
    gradio_app.launch(debug=True)