fudii0921 commited on
Commit
8a55f36
·
verified ·
1 Parent(s): 561ae3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -9,24 +9,25 @@ groqkey = os.environ.get("GROQ_API_KEY")
9
 
10
  def toggle_all(prompt):
11
  # ここでタブの可視性を切り替えるロジックを追加
12
- client = Groq(api_key=groqkey)
 
13
 
14
- response = client.chat.completions.create(
15
- messages=[
16
- {
17
- "role": "system",
18
- "content": "you are a helpful assistant."
19
- },
20
- {
21
- "role": "user",
22
- "content": prompt,
23
- }
24
- ],
25
- model="llama-3.3-70b-versatile",
26
- )
27
- answer = response.choices[0].message.content
28
- #answer = prompt+" answered."
29
- return gr.update(visible=True), answer
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