Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,9 +2,6 @@ import os
|
|
2 |
import gradio as gr
|
3 |
from groq import Groq
|
4 |
|
5 |
-
import gradio as gr
|
6 |
-
from groq import Groq
|
7 |
-
|
8 |
def generate_response(prompt, history, model, temperature, max_tokens, top_p):
|
9 |
client = Groq(
|
10 |
api_key = os.environ.get("Groq_Api_Key")
|
@@ -13,7 +10,7 @@ def generate_response(prompt, history, model, temperature, max_tokens, top_p):
|
|
13 |
stream = client.chat.completions.create(
|
14 |
messages=[
|
15 |
{"role": "system", "content": "you are a helpful assistant."},
|
16 |
-
{"role": "user", "content":
|
17 |
],
|
18 |
model=model,
|
19 |
temperature=temperature,
|
@@ -33,10 +30,10 @@ def generate_response(prompt, history, model, temperature, max_tokens, top_p):
|
|
33 |
|
34 |
# Define the Gradio chat interface
|
35 |
additional_inputs = [
|
36 |
-
gr.Dropdown(choices=["llama3-70b-8192", "llama3-8b-8192", "mixtral-8x7b-32768", "llama2-70b-4096", "gemma-7b-it"], label="Model"),
|
37 |
-
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Temperature"),
|
38 |
-
gr.Slider(minimum=1, maximum=4096, step=1, label="Max Tokens"),
|
39 |
-
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label="Top P"),
|
40 |
]
|
41 |
|
42 |
gr.ChatInterface(
|
@@ -44,5 +41,5 @@ gr.ChatInterface(
|
|
44 |
chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
45 |
additional_inputs=additional_inputs,
|
46 |
title="Groq API LLMs AI Models",
|
47 |
-
description="Using https://groq.com/ api, ofc as its free it will have some limitations so its better if you duplicate this space with your own api key<br>Hugging Face Space by [Nick088](https://linktr.ee/Nick088",
|
48 |
).launch()
|
|
|
2 |
import gradio as gr
|
3 |
from groq import Groq
|
4 |
|
|
|
|
|
|
|
5 |
def generate_response(prompt, history, model, temperature, max_tokens, top_p):
|
6 |
client = Groq(
|
7 |
api_key = os.environ.get("Groq_Api_Key")
|
|
|
10 |
stream = client.chat.completions.create(
|
11 |
messages=[
|
12 |
{"role": "system", "content": "you are a helpful assistant."},
|
13 |
+
{"role": "user", "content": prompt}
|
14 |
],
|
15 |
model=model,
|
16 |
temperature=temperature,
|
|
|
30 |
|
31 |
# Define the Gradio chat interface
|
32 |
additional_inputs = [
|
33 |
+
gr.Dropdown(choices=["llama3-70b-8192", "llama3-8b-8192", "mixtral-8x7b-32768", "llama2-70b-4096", "gemma-7b-it"], value="llama3-70b-8192", label="LLM Model"),
|
34 |
+
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.5, label="Temperature"),
|
35 |
+
gr.Slider(minimum=1, maximum=4096, step=1, value=4096, label="Max Tokens"),
|
36 |
+
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.5, label="Top P"),
|
37 |
]
|
38 |
|
39 |
gr.ChatInterface(
|
|
|
41 |
chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
|
42 |
additional_inputs=additional_inputs,
|
43 |
title="Groq API LLMs AI Models",
|
44 |
+
description="Using https://groq.com/ api, ofc as its free it will have some limitations so its better if you duplicate this space with your own api key<br>Hugging Face Space by [Nick088](https://linktr.ee/Nick088)",
|
45 |
).launch()
|