Pasula commited on
Commit
c4e9fb6
·
verified ·
1 Parent(s): b2aad30

revert changes back

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -1,8 +1,7 @@
1
- import streamlit as st
2
  import os
3
  from groq import Groq # Ensure Groq library supports this usage
4
  from dotenv import load_dotenv
5
-
6
  load_dotenv()
7
 
8
  os.getenv("GROQ_API_KEY")
@@ -11,26 +10,16 @@ def fetch_response(user_input):
11
  client = Groq(api_key=os.getenv("GROQ_API_KEY"))
12
  chat_completion = client.chat.completions.create(
13
  messages=[
14
- {"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper examples to help the user. Try to mention references or provide citations to make it more detail-oriented."},
15
  {"role": "user", "content": user_input},
16
  ],
17
  model="mixtral-8x7b-32768",
18
- temperature=0.5,
19
- max_tokens=1024,
20
- top_p=1,
21
- stop=None,
22
  stream=False
23
  )
24
  return chat_completion.choices[0].message.content
 
 
 
25
 
26
- def main():
27
- st.title("Fastest AI Chatbot By Klizos")
28
- st.write("Ask a question and get a response.")
29
-
30
- user_input = st.text_input("You:", "")
31
- if user_input:
32
- response = fetch_response(user_input)
33
- st.text_area("Chatbot:", response, height=200)
34
-
35
- if __name__ == "__main__":
36
- main()
 
1
+ import gradio as gr
2
  import os
3
  from groq import Groq # Ensure Groq library supports this usage
4
  from dotenv import load_dotenv
 
5
  load_dotenv()
6
 
7
  os.getenv("GROQ_API_KEY")
 
10
  client = Groq(api_key=os.getenv("GROQ_API_KEY"))
11
  chat_completion = client.chat.completions.create(
12
  messages=[
13
+ {"role": "system", "content": "you are a helpful assistant. Take the input from the users and try to provide as detailed response as possible. Provide proper expamples to help the user. Try to mention references or provide citations to make it more detail oriented."},
14
  {"role": "user", "content": user_input},
15
  ],
16
  model="mixtral-8x7b-32768",
 
 
 
 
17
  stream=False
18
  )
19
  return chat_completion.choices[0].message.content
20
+ # for each in chat_completion:
21
+ # yield (each.choices[0].delta.content)
22
+ # #end=""
23
 
24
+ iface = gr.Interface(fn=fetch_response, inputs="text", outputs="text", title="Fastest AI Chatbot By Klizos", description="Ask a question and get a response.")
25
+ iface.launch()