Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,24 +9,25 @@ groqkey = os.environ.get("GROQ_API_KEY")
|
|
| 9 |
|
| 10 |
def toggle_all(prompt):
|
| 11 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
| 32 |
# ^ expect a gr.OAuthProfile object as input to get the user's profile
|
|
|
|
| 9 |
|
| 10 |
def toggle_all(prompt):
|
| 11 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 12 |
+
if not prompt == '':
|
| 13 |
+
client = Groq(api_key=groqkey)
|
| 14 |
|
| 15 |
+
response = client.chat.completions.create(
|
| 16 |
+
messages=[
|
| 17 |
+
{
|
| 18 |
+
"role": "system",
|
| 19 |
+
"content": "you are a helpful assistant."
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"role": "user",
|
| 23 |
+
"content": prompt,
|
| 24 |
+
}
|
| 25 |
+
],
|
| 26 |
+
model="llama-3.3-70b-versatile",
|
| 27 |
+
)
|
| 28 |
+
answer = response.choices[0].message.content
|
| 29 |
+
#answer = prompt+" answered."
|
| 30 |
+
return gr.update(visible=True), answer
|
| 31 |
|
| 32 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
| 33 |
# ^ expect a gr.OAuthProfile object as input to get the user's profile
|