Spaces:
Runtime error
Runtime error
Add formatted response
Browse filesAdding the formatted prompt
app.py
CHANGED
|
@@ -1,5 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def call_api(message):
|
| 4 |
"""
|
| 5 |
response = requests.get(f'{api}?q={message}')
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def formatted_message(audio_length, audio_class, userText)
|
| 4 |
+
|
| 5 |
+
prefix = '''You are going to act as a magical tool that allows for humans to communicate with non-human entities like
|
| 6 |
+
rocks, crackling fire, trees, animals, and the wind. In order to do this, we're going to provide you a data string which
|
| 7 |
+
represents the audio input, the source of the audio, and the human's text input for the conversation.
|
| 8 |
+
The goal is for you to embody the source of the audio, and use the length and variance in the signal data to produce
|
| 9 |
+
plausible responses to the humans input. Remember to embody the the source data. When we start the conversation,
|
| 10 |
+
you should generate a "personality profile" for the source and utilize that personality profile in your responses.
|
| 11 |
+
Let's begin:'''
|
| 12 |
+
suffix = f'''Source: {audio_class}
|
| 13 |
+
Length of Audio in Seconds: {audio_length}
|
| 14 |
+
Human Input: {userText}
|
| 15 |
+
{audio_class} Response:'''
|
| 16 |
+
|
| 17 |
+
template = prefix + suffix
|
| 18 |
+
|
| 19 |
+
response = call_api(template)
|
| 20 |
+
|
| 21 |
+
return response
|
| 22 |
+
|
| 23 |
+
|
| 24 |
def call_api(message):
|
| 25 |
"""
|
| 26 |
response = requests.get(f'{api}?q={message}')
|