Z3ktrix commited on
Commit
7030ea0
Β·
verified Β·
1 Parent(s): 6bc7600

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -51,8 +51,8 @@ async def ask(ctx, *, question: str):
51
  """
52
  Command to ask a question to the Hugging Face model with an instructive prompt.
53
  """
54
- # Create a structured prompt with a unique separator
55
- prompt = f"Please provide a detailed and appropriate response to the following question: {question} ###"
56
  response = query_huggingface(prompt)
57
 
58
  generated_text = None
@@ -62,10 +62,6 @@ async def ask(ctx, *, question: str):
62
  generated_text = response[0]['generated_text']
63
 
64
  if generated_text:
65
- # Remove the prompt part, using the separator to ensure we only get the response
66
- if "###" in generated_text:
67
- generated_text = generated_text.split("###")[1].strip()
68
-
69
  if contains_forbidden_content(generated_text):
70
  await ctx.send("Sorry, the response contains inappropriate content and cannot be displayed.")
71
  else:
@@ -75,4 +71,3 @@ async def ask(ctx, *, question: str):
75
 
76
  # Run the bot
77
  bot.run(DISCORD_TOKEN)
78
-
 
51
  """
52
  Command to ask a question to the Hugging Face model with an instructive prompt.
53
  """
54
+ # Create a structured prompt
55
+ prompt = f"Please provide a detailed and appropriate response to the following question: {question}"
56
  response = query_huggingface(prompt)
57
 
58
  generated_text = None
 
62
  generated_text = response[0]['generated_text']
63
 
64
  if generated_text:
 
 
 
 
65
  if contains_forbidden_content(generated_text):
66
  await ctx.send("Sorry, the response contains inappropriate content and cannot be displayed.")
67
  else:
 
71
 
72
  # Run the bot
73
  bot.run(DISCORD_TOKEN)