Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
from huggingface_hub import list_models
|
| 4 |
import os
|
| 5 |
from dotenv import load_dotenv
|
|
@@ -11,23 +11,23 @@ print(groqkey)
|
|
| 11 |
|
| 12 |
def toggle_all(prompt):
|
| 13 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
-
model="llama-3.3-70b-versatile",
|
| 18 |
messages=[
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
],
|
| 24 |
-
|
| 25 |
-
max_tokens=4096,
|
| 26 |
-
stream=False,
|
| 27 |
-
stop=None,
|
| 28 |
)
|
| 29 |
-
answer = response.choices[0].message.content
|
| 30 |
-
answer = prompt+" answered."
|
| 31 |
return gr.update(visible=True), answer
|
| 32 |
|
| 33 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from groq import Groq
|
| 3 |
from huggingface_hub import list_models
|
| 4 |
import os
|
| 5 |
from dotenv import load_dotenv
|
|
|
|
| 11 |
|
| 12 |
def toggle_all(prompt):
|
| 13 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 14 |
+
client = Groq(api_key=groqkey)
|
| 15 |
|
| 16 |
+
response = = client.chat.completions.create(
|
|
|
|
| 17 |
messages=[
|
| 18 |
+
{
|
| 19 |
+
"role": "system",
|
| 20 |
+
"content": "you are a helpful assistant."
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"role": "user",
|
| 24 |
+
"content": prompt,
|
| 25 |
+
}
|
| 26 |
],
|
| 27 |
+
model="llama-3.3-70b-versatile",
|
|
|
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
+
answer = response.choices[0].message.content
|
| 30 |
+
#answer = prompt+" answered."
|
| 31 |
return gr.update(visible=True), answer
|
| 32 |
|
| 33 |
def hello(profile: gr.OAuthProfile | None) -> str:
|