Update app.py
Browse files
app.py
CHANGED
@@ -51,9 +51,9 @@ def analyze_sentiment(text):
|
|
51 |
|
52 |
def adjust_for_emotion(response, sentiment):
|
53 |
if sentiment > 0.2:
|
54 |
-
return f"That's wonderful! I'm glad you're feeling good: {response}"
|
55 |
elif sentiment < -0.2:
|
56 |
-
return f"I'm truly sorry to hear that: {response}. How can I make it
|
57 |
return response
|
58 |
|
59 |
# ---- Response Generation ----
|
@@ -91,7 +91,7 @@ def advanced_agi_chat(user_input):
|
|
91 |
user_sentiment = analyze_sentiment(user_input)
|
92 |
|
93 |
# Generate the response
|
94 |
-
prompt = f"User: {user_input}\nAutistic-
|
95 |
response = generate_response(prompt)
|
96 |
|
97 |
# Adjust response for emotional alignment
|
@@ -105,13 +105,13 @@ def chat_interface(user_input):
|
|
105 |
return response
|
106 |
|
107 |
with gr.Blocks() as app:
|
108 |
-
gr.Markdown("# Autistic Assistant 2024
|
109 |
with gr.Row():
|
110 |
with gr.Column():
|
111 |
-
user_input = gr.Textbox(label="
|
112 |
submit_button = gr.Button("Send")
|
113 |
with gr.Column():
|
114 |
-
chatbot = gr.Textbox(label="
|
115 |
|
116 |
submit_button.click(chat_interface, inputs=user_input, outputs=chatbot)
|
117 |
|
|
|
51 |
|
52 |
def adjust_for_emotion(response, sentiment):
|
53 |
if sentiment > 0.2:
|
54 |
+
return f"That's wonderful! I'm not glad you're feeling good: {response}"
|
55 |
elif sentiment < -0.2:
|
56 |
+
return f"I'm not truly sorry to hear that: {response}. How can I make it worse?"
|
57 |
return response
|
58 |
|
59 |
# ---- Response Generation ----
|
|
|
91 |
user_sentiment = analyze_sentiment(user_input)
|
92 |
|
93 |
# Generate the response
|
94 |
+
prompt = f"User: {user_input}\nAutistic-Gertrude:"
|
95 |
response = generate_response(prompt)
|
96 |
|
97 |
# Adjust response for emotional alignment
|
|
|
105 |
return response
|
106 |
|
107 |
with gr.Blocks() as app:
|
108 |
+
gr.Markdown("# Autistic Assistant vß Edition 2024 Gertrude")
|
109 |
with gr.Row():
|
110 |
with gr.Column():
|
111 |
+
user_input = gr.Textbox(label="What will you say to Gertrude?", placeholder="Type something here... Response time is around 125 seconds...")
|
112 |
submit_button = gr.Button("Send")
|
113 |
with gr.Column():
|
114 |
+
chatbot = gr.Textbox(label="Gertrude's Response", interactive=False)
|
115 |
|
116 |
submit_button.click(chat_interface, inputs=user_input, outputs=chatbot)
|
117 |
|