artintel235 commited on
Commit
c57b527
·
verified ·
1 Parent(s): a063c0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -43,8 +43,9 @@ async def generate_command(
43
  await interaction.response.defer() # Defer the interaction
44
  genai.configure(api_key=GEMINI_API_KEY)
45
  model = genai.GenerativeModel("gemini-2.0-flash-exp")
46
- response = model.generate_content(prompt)
47
- await interaction.followup.send(content=response.text)
 
48
  except Exception as e:
49
  print(e)
50
 
 
43
  await interaction.response.defer() # Defer the interaction
44
  genai.configure(api_key=GEMINI_API_KEY)
45
  model = genai.GenerativeModel("gemini-2.0-flash-exp")
46
+ response = model.generate_content(prompt, stream=True)
47
+ for part in response:
48
+ await interaction.followup.send(content=part.text)
49
  except Exception as e:
50
  print(e)
51