Radosław Wolnik commited on
Commit
4fca44d
·
1 Parent(s): 6fa41c8
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import discord
2
  from discord.ext import commands
3
  from ChatAI.chat_ai import pipe as ai
 
4
 
5
 
6
  # Set up Discord bot intents and command prefix
@@ -64,7 +65,12 @@ def generate(
64
  seed=42,
65
  )
66
 
67
- return ai.text_generation(prompt, **generate_kwargs, stream=False, details=True, return_full_text=True)
 
 
 
 
 
68
 
69
  @bot.event
70
  async def on_ready():
 
1
  import discord
2
  from discord.ext import commands
3
  from ChatAI.chat_ai import pipe as ai
4
+ from huggingface_hub import InferenceClient
5
 
6
 
7
  # Set up Discord bot intents and command prefix
 
65
  seed=42,
66
  )
67
 
68
+ stream = ai.text_generation(prompt, **generate_kwargs, stream=False, details=True, return_full_text=True)
69
+ output = ""
70
+ for response in stream:
71
+ output += response.token.text
72
+ yield output
73
+ return output
74
 
75
  @bot.event
76
  async def on_ready():