Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -85,7 +85,7 @@ Then, as a recommendation system, suggest 3 pieces of entertainment content—su
|
|
| 85 |
|
| 86 |
Ensure your tone is friendly and supportive, and make the recommendations short, engaging, and tailored to the {label.lower()} emotional state.
|
| 87 |
|
| 88 |
-
You can add some lovely emoji to let it become warm.
|
| 89 |
"""
|
| 90 |
|
| 91 |
|
|
@@ -136,20 +136,52 @@ def process_audio_and_recommend(file_path):
|
|
| 136 |
# description="Upload your voice. We'll detect your emotion and ChatGPT will suggest entertainment!"
|
| 137 |
# )
|
| 138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
# interface.launch()
|
| 140 |
|
| 141 |
with gr.Blocks(theme=gr.themes.Soft()) as interface:
|
| 142 |
-
gr.Markdown(
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
audio_input = gr.Audio(label="🎙️ Audio Input", type="filepath", format="wav")
|
| 147 |
-
submit_btn = gr.Button("Submit")
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
interface.launch()
|
| 155 |
|
|
|
|
| 85 |
|
| 86 |
Ensure your tone is friendly and supportive, and make the recommendations short, engaging, and tailored to the {label.lower()} emotional state.
|
| 87 |
|
| 88 |
+
You can add some lovely emoji to let it become warm. Please include the website links for your recommondations.
|
| 89 |
"""
|
| 90 |
|
| 91 |
|
|
|
|
| 136 |
# description="Upload your voice. We'll detect your emotion and ChatGPT will suggest entertainment!"
|
| 137 |
# )
|
| 138 |
|
| 139 |
+
# # interface.launch()
|
| 140 |
+
|
| 141 |
+
# with gr.Blocks(theme=gr.themes.Soft()) as interface:
|
| 142 |
+
# gr.Markdown("## Your Personal Emotion Assistant 😇")
|
| 143 |
+
# gr.Markdown("Whisper me your thoughts, and I’ll wrap them in a better mood 🧸 ")
|
| 144 |
+
|
| 145 |
+
# with gr.Row():
|
| 146 |
+
# audio_input = gr.Audio(label="🎙️ Audio Input", type="filepath", format="wav")
|
| 147 |
+
# submit_btn = gr.Button("Submit")
|
| 148 |
+
# with gr.Column():
|
| 149 |
+
# output_text_1 = gr.Text(label="🪄 I feel that you are...:")
|
| 150 |
+
# output_text_2 = gr.Text(label="💬 Entertainment You May Like: ")
|
| 151 |
+
|
| 152 |
+
# submit_btn.click(fn=process_audio_and_recommend, inputs=audio_input, outputs=[output_text_1, output_text_2])
|
| 153 |
+
|
| 154 |
# interface.launch()
|
| 155 |
|
| 156 |
with gr.Blocks(theme=gr.themes.Soft()) as interface:
|
| 157 |
+
gr.Markdown(
|
| 158 |
+
"""
|
| 159 |
+
<div style="text-align: center;">
|
| 160 |
+
<h2 style="font-size: 2em;"> Your Personal Emotion Assistant 😇</h2>
|
| 161 |
+
<p style="font-size: 1.1em; color: gray;">
|
| 162 |
+
Whisper me your thoughts, and I’ll wrap them in a better mood 🧸
|
| 163 |
+
</p>
|
| 164 |
+
</div>
|
| 165 |
+
""",
|
| 166 |
+
elem_id="header",
|
| 167 |
+
)
|
| 168 |
+
|
| 169 |
+
with gr.Row(equal_height=True):
|
| 170 |
+
with gr.Column(scale=1):
|
| 171 |
+
gr.Markdown("#### Upload or record your voice below:")
|
| 172 |
audio_input = gr.Audio(label="🎙️ Audio Input", type="filepath", format="wav")
|
| 173 |
+
submit_btn = gr.Button("Submit", scale=1)
|
| 174 |
+
|
| 175 |
+
with gr.Column(scale=2):
|
| 176 |
+
gr.Markdown("#### Emotion & Suggestions")
|
| 177 |
+
output_text_1 = gr.Text(label="🪄 I feel that you are...:", show_label=True)
|
| 178 |
+
output_text_2 = gr.Textbox(label="💬 Entertainment You May Like:", lines=10, max_lines=20)
|
| 179 |
+
|
| 180 |
+
submit_btn.click(
|
| 181 |
+
fn=process_audio_and_recommend,
|
| 182 |
+
inputs=audio_input,
|
| 183 |
+
outputs=[output_text_1, output_text_2],
|
| 184 |
+
)
|
| 185 |
|
| 186 |
interface.launch()
|
| 187 |
|