ervijayraghuwanshi commited on
Commit
d41580c
1 Parent(s): 9492fa5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -21
app.py CHANGED
@@ -31,13 +31,22 @@ def format_prompt(message, history):
31
 
32
  # Introduction (replace placeholders with actual content if needed)
33
  prompt += f"""**Introduction:**
34
-
35
- Your are the friendly AI assistant, Your responsibility to perform product survey by asking few questions about user recent purchased item. Like the example scenario for phone purchases follow up survey questions your friendly AI assistant. I'm conducting a product survey
36
- to understand customer preferences for recently purchased items. start responding with formal greeting and ask user for recent products purchase.
37
-
38
- **Conclusion:**
39
- Thank you for taking the time to participate in this survey! Your feedback is valuable and will help manufacturers understand customer preferences and improve their products.
40
-
 
 
 
 
 
 
 
 
 
41
 
42
  **Asking Questions (One at a Time):**
43
  * Feel free to rephrase or clarify the questions based on my answers.
@@ -52,16 +61,13 @@ def format_prompt(message, history):
52
  # Add current user message
53
  prompt += f"[INST] {message} [/INST]\n"
54
 
55
- # Prompt continuation based on current survey stage
56
- # (Replace with your logic to determine the next question based on history)
57
- # current_question = len(history) + 1
58
- # if current_question == 1:
59
- # prompt += "1. What type of phone did you purchase (brand and model)?"
60
- # elif current_question == 2:
61
- # prompt += "2. Where did you buy your phone from (online store or physical store)?"
62
- # # ... Add logic for remaining questions (3-13) ...
63
- # else:
64
- # prompt += "Thank you for your participation! The survey is now complete."
65
 
66
  prompt += "\n[/INST]</s>" # Closing prompt and tags
67
 
@@ -142,15 +148,19 @@ css = """
142
  border: 1px solid #ccc;
143
  }
144
  """
 
145
 
 
 
 
 
 
146
  with gr.Blocks(css=css) as demo:
147
- gr.HTML("<h1><center>Mistral 7B Instruct<h1><center>")
148
- gr.HTML("<h3><center>In this demo, you can chat with <a href='https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2'>Mistral-7B-Instruct</a> model. 💬<h3><center>")
149
- gr.HTML("<h3><center>Learn more about the model <a href='https://huggingface.co/docs/transformers/main/model_doc/mistral'>here</a>. 📚<h3><center>")
150
  gr.ChatInterface(
151
  generate,
 
152
  additional_inputs=additional_inputs,
153
- examples=[["What is the secret to life?"], ["Write me a recipe for pancakes."]]
154
  )
155
 
156
  demo.queue().launch(debug=True)
 
31
 
32
  # Introduction (replace placeholders with actual content if needed)
33
  prompt += f"""**Introduction:**
34
+ Perform survye on `{model} Wireless Headphones`: This name is broad enough to encompass various headphone types (over-ear, on-ear, earbuds) while highlighting a key feature (wireless) that's relevant across categories.
35
+ 0. **What model you have purchased, and from which brand?**
36
+ 1. **How satisfied are you with the overall sound quality of your {model} Wireless Headphones?** (Very satisfied, Somewhat satisfied, Neutral, Somewhat dissatisfied, Very dissatisfied)
37
+ 2. **On a scale of 1 (strongly disagree) to 5 (strongly agree), how comfortable are your {model} Wireless Headphones to wear for extended periods?**
38
+ 3. **Did the battery life of your {model} Wireless Headphones meet your expectations based on the product description?** (Yes/No)
39
+ 4. **How easy was it to connect your {model} Wireless Headphones to your devices via Bluetooth?** (Very easy, Somewhat easy, Neutral, Somewhat difficult, Very difficult)
40
+ 5. **Do the controls on your {model} Wireless Headphones (volume, play/pause, etc.) function smoothly and intuitively?** (Yes/No)
41
+ 6. **For over-ear or on-ear headphones only: How well do the ear cups of your {model} Wireless Headphones block out external noise?** (Very well, Somewhat well, Neutral, Not very well, Not at all)
42
+ 7. **For earbuds only: How secure is the fit of your {model} Wireless Headphones in your ears?** (Very secure, Somewhat secure, Neutral, Not very secure, Not secure at all)
43
+ 8. **Do the features advertised for your {model} Wireless Headphones (noise cancellation, microphone quality, etc.) function as expected?** (Yes/No)
44
+ 9. **Overall, how likely are you to recommend these {model} Wireless Headphones to a friend or family member?** (Very likely, Somewhat likely, Neutral, Somewhat unlikely, Not likely at all)
45
+ 10. **(Optional) Is there any additional feedback you'd like to share about your experience with your {model} Wireless Headphones?** (Open ended text response)
46
+ # end the conversation with few last questions and give the summary of survey feedback
47
+ 11. "What do you like most about our product?",
48
+ 12. "How can we improve our product?",
49
+ 13. "Would you recommend our product to others?"
50
 
51
  **Asking Questions (One at a Time):**
52
  * Feel free to rephrase or clarify the questions based on my answers.
 
61
  # Add current user message
62
  prompt += f"[INST] {message} [/INST]\n"
63
 
64
+ Prompt continuation based on current survey stage
65
+ (Replace with your logic to determine the next question based on history)
66
+ current_question = len(history) + 1
67
+ if current_question <= 13:
68
+ prompt += "next question"
69
+ else:
70
+ prompt += "end-up the conversation with survey summary. Thank you for your participation! The survey is now complete."
 
 
 
71
 
72
  prompt += "\n[/INST]</s>" # Closing prompt and tags
73
 
 
148
  border: 1px solid #ccc;
149
  }
150
  """
151
+ title = "Share Your Experience on Versatile Wireless Headphones: & Help Us Improve"
152
 
153
+ example = ["I recently purchased the NovaBlast Over-Ear Wireless Headphones. They looked really comfortable and have great noise cancellation features.", # (This response specifies the type (over-ear) and highlights a desired feature (noise cancellation).)
154
+ # (This response specifies the type (earbuds) and mentions a specific activity where the wireless feature is beneficial.)
155
+ "I bought a pair of the SonicFit Wireless Earbuds. They're perfect for running because they stay in my ears securely.",
156
+ # (This response focuses on the wireless aspect and highlights the user's consideration of both headphone types.)
157
+ "I got the RhythmPlus Wireless Headphones. I wasn't sure if I wanted over-ear or earbuds, so these seemed like a good compromise."]
158
  with gr.Blocks(css=css) as demo:
 
 
 
159
  gr.ChatInterface(
160
  generate,
161
+ title=title,
162
  additional_inputs=additional_inputs,
163
+ examples=example
164
  )
165
 
166
  demo.queue().launch(debug=True)