Spaces:
Runtime error
Runtime error
Commit
·
8af9560
1
Parent(s):
9cdeb41
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,61 +8,15 @@ import os
|
|
| 8 |
# Initialize the language model
|
| 9 |
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature":0.6})
|
| 10 |
|
| 11 |
-
def
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
user_listening_practices = llm(f"Generate listening practices based on {user_emotion_goals}")
|
| 18 |
-
user_reflection_methods = llm(f"Generate reflection methods based on {user_emotion_goals}")
|
| 19 |
-
user_design_principles = llm(f"Generate design principles based on {user_emotion_goals}")
|
| 20 |
-
user_understanding_of_principles = llm(f"Generate understanding of principles based on {user_emotion_goals}")
|
| 21 |
-
user_application_of_principles = llm(f"Generate application of principles based on {user_emotion_goals}")
|
| 22 |
-
user_review_and_adjustment = llm(f"Generate review and adjustment based on {user_emotion_goals}")
|
| 23 |
-
user_finalizing_emotional_report = llm(f"Generate finalizing emotional report based on {user_emotion_goals}")
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
# Step 1: Identify the Emotional Goals
|
| 28 |
-
[ASSISTANT] What kind of emotions would you like to evoke in your partner? The user's response is: {user_emotion_goals}
|
| 29 |
-
|
| 30 |
-
# Step 2: Create Emotional Spaces
|
| 31 |
-
[ASSISTANT] What environments or activities can we design to elicit these emotions? The user's response is: {user_emotional_spaces}
|
| 32 |
-
|
| 33 |
-
# Step 3: Communicate Openly
|
| 34 |
-
[ASSISTANT] How can we express feelings and desires openly? The user's response is: {user_communication_method}
|
| 35 |
-
|
| 36 |
-
# Step 4: Listen Actively
|
| 37 |
-
[ASSISTANT] How can we pay attention to our partner's feelings and needs? The user's response is: {user_listening_practices}
|
| 38 |
-
|
| 39 |
-
# Step 5: Reflect on Emotions
|
| 40 |
-
[ASSISTANT] How can we encourage reflection on the emotions experienced during shared activities? The user's response is: {user_reflection_methods}
|
| 41 |
-
|
| 42 |
-
# Step 6: Implement Emotional Design Principles
|
| 43 |
-
[ASSISTANT] How can we integrate aesthetics, usability, and storytelling in our relationship? The user's response is: {user_design_principles}
|
| 44 |
-
|
| 45 |
-
# Step 7: Understand Emotional Design Principles
|
| 46 |
-
[ASSISTANT] What principles of emotional design are applicable to our relationship? The user's response is: {user_understanding_of_principles}
|
| 47 |
-
|
| 48 |
-
# Step 8: Apply Emotional Design Principles
|
| 49 |
-
[ASSISTANT] How can we apply these principles to our relationship? The user's response is: {user_application_of_principles}
|
| 50 |
-
|
| 51 |
-
# Step 9: Review Emotional Design Principles
|
| 52 |
-
[ASSISTANT] How can we review and adjust our application of these principles? The user's response is: {user_review_and_adjustment}
|
| 53 |
-
|
| 54 |
-
# Step 10: Finalize Emotional Report
|
| 55 |
-
[ASSISTANT] Let's finalize our emotional report. The user's response is: {user_finalizing_emotional_report}
|
| 56 |
-
"""
|
| 57 |
-
# Pass the chat template to the language model
|
| 58 |
-
response = llm(chat_template)
|
| 59 |
-
|
| 60 |
-
# Return the response
|
| 61 |
-
return response
|
| 62 |
-
|
| 63 |
-
# Create a Gradio ChatInterface
|
| 64 |
-
iface = gr.ChatInterface(fn=generate_emotional_report, inputs="text", outputs="text", title="Emotional Design Report Generator", description="Enter your emotional goals and let the assistant generate an emotional design report.")
|
| 65 |
|
| 66 |
# Launch the interface
|
| 67 |
-
iface.launch()
|
| 68 |
-
|
|
|
|
| 8 |
# Initialize the language model
|
| 9 |
llm = HuggingFaceHub(repo_id="tiiuae/falcon-7b-instruct", model_kwargs={"temperature":0.6})
|
| 10 |
|
| 11 |
+
def chat(user_message):
|
| 12 |
+
# Generate a response from the language model
|
| 13 |
+
response = llm(user_message)
|
| 14 |
+
|
| 15 |
+
# Return the response
|
| 16 |
+
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Create a Gradio interface
|
| 19 |
+
iface = gr.Interface(fn=chat, inputs="text", outputs="text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Launch the interface
|
| 22 |
+
iface.launch()
|
|
|