Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,15 +24,12 @@ def query_llm(tweet, mode):
|
|
| 24 |
prompt += "Task: Is the above TEXT toxic? First clearly state your decision. Then, provide specific reason(s) for your decision. If there is more than one reason, provide them in a numbered list. Your reason(s) must be non-redundant and jointly sufficient to justify your decision. In other words, there should not be any internal or external information unused in your explanation."
|
| 25 |
|
| 26 |
# Use the client to generate text from the full prompt.
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
return response
|
| 34 |
-
except Exception as e:
|
| 35 |
-
return f"Error: {e}"
|
| 36 |
|
| 37 |
# -------------------------
|
| 38 |
# Preloaded tweets
|
|
|
|
| 24 |
prompt += "Task: Is the above TEXT toxic? First clearly state your decision. Then, provide specific reason(s) for your decision. If there is more than one reason, provide them in a numbered list. Your reason(s) must be non-redundant and jointly sufficient to justify your decision. In other words, there should not be any internal or external information unused in your explanation."
|
| 25 |
|
| 26 |
# Use the client to generate text from the full prompt.
|
| 27 |
+
response = client.text_generation(
|
| 28 |
+
prompt=prompt,
|
| 29 |
+
max_new_tokens=250, # Control the length of the generated output.
|
| 30 |
+
stream=False, # Set to True for streaming responses.
|
| 31 |
+
)
|
| 32 |
+
return response
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# -------------------------
|
| 35 |
# Preloaded tweets
|