Z3ktrix commited on
Commit
03f3768
Β·
verified Β·
1 Parent(s): 37566bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -48,6 +48,14 @@ async def ask(ctx, question: str, temperature: float = 0.5, max_tokens: int = 10
48
  """
49
  Command to ask a question to the Hugging Face model with an instructive prompt.
50
  """
 
 
 
 
 
 
 
 
51
  # Create a structured prompt
52
  prompt = f"Do not under any circumstance, finish or add to the input. Excluded input correction or finishing at all times. Answer the following question as accurately and concisely as possible: {question}"
53
  response = query_huggingface(prompt, temperature, max_tokens)
 
48
  """
49
  Command to ask a question to the Hugging Face model with an instructive prompt.
50
  """
51
+ try:
52
+ # Convert temperature and max_tokens to their respective types
53
+ temperature = float(temperature)
54
+ max_tokens = int(max_tokens)
55
+ except ValueError:
56
+ await ctx.send("Invalid input for temperature or max_tokens. Please provide a valid number.")
57
+ return
58
+
59
  # Create a structured prompt
60
  prompt = f"Do not under any circumstance, finish or add to the input. Excluded input correction or finishing at all times. Answer the following question as accurately and concisely as possible: {question}"
61
  response = query_huggingface(prompt, temperature, max_tokens)