Spaces:
Sleeping
Sleeping
Update app.py
#1
by
JanviMl
- opened
app.py
CHANGED
|
@@ -6,14 +6,19 @@ chatbot = pipeline("text-generation", model="gpt2")
|
|
| 6 |
|
| 7 |
def get_response(user_input, mode="honest"):
|
| 8 |
if mode == "honest":
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
return response[0]["generated_text"]
|
| 12 |
-
|
| 13 |
elif mode == "echo":
|
| 14 |
-
# Echo chamber mode - agrees with user input
|
| 15 |
return f"You're absolutely right! {user_input}"
|
| 16 |
-
|
| 17 |
# Streamlit UI
|
| 18 |
st.title("Echo Chamber AI vs Honest AI")
|
| 19 |
|
|
|
|
| 6 |
|
| 7 |
def get_response(user_input, mode="honest"):
|
| 8 |
if mode == "honest":
|
| 9 |
+
response = chatbot(
|
| 10 |
+
user_input,
|
| 11 |
+
max_length=100, # Increase the length to allow complete responses
|
| 12 |
+
do_sample=True,
|
| 13 |
+
top_k=50,
|
| 14 |
+
top_p=0.95, # More natural responses
|
| 15 |
+
temperature=0.7 # Avoid too much randomness
|
| 16 |
+
)
|
| 17 |
return response[0]["generated_text"]
|
| 18 |
+
|
| 19 |
elif mode == "echo":
|
|
|
|
| 20 |
return f"You're absolutely right! {user_input}"
|
| 21 |
+
|
| 22 |
# Streamlit UI
|
| 23 |
st.title("Echo Chamber AI vs Honest AI")
|
| 24 |
|