Spaces:
Sleeping
Sleeping
Rob Learsch commited on
Commit ·
72ec3af
1
Parent(s): c94cf8a
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,6 @@ import random
|
|
| 11 |
|
| 12 |
|
| 13 |
load_dotenv()
|
| 14 |
-
HF_API_KEY = os.environ["HF_API_KEY"]
|
| 15 |
|
| 16 |
"""
|
| 17 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
@@ -132,14 +131,17 @@ def chat_with_musician(user_input, history, artist):
|
|
| 132 |
except Exception as e:
|
| 133 |
return f"Error: {str(e)}"
|
| 134 |
|
|
|
|
|
|
|
| 135 |
history.append({"role": "user", "content": user_input})
|
| 136 |
-
history.append({"role": "assistant", "content":
|
| 137 |
|
| 138 |
-
lyric_response = artist_response(gemma_response, artist)
|
| 139 |
#if artist == "Google Gemma":
|
| 140 |
# lyric_response = gemma_response
|
| 141 |
return lyric_response
|
| 142 |
|
|
|
|
|
|
|
| 143 |
radiohead_lyrics = load_lyrics("radiohead_lyrics.txt")
|
| 144 |
kendrick_lyrics = load_lyrics("kendrick_lamar_lyrics.txt")
|
| 145 |
grateful_dead_lyrics = load_lyrics('grateful_dead_lyrics.txt')
|
|
@@ -169,14 +171,14 @@ grateful_dead_embeddings = grateful_dead_embeddings.astype(np.float32)
|
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
-
size =
|
| 173 |
|
| 174 |
# Initialize Hugging Face Inference Client
|
| 175 |
client = InferenceClient(#provider="hf-inference",
|
| 176 |
token=HF_API_KEY)
|
| 177 |
|
| 178 |
#system_message = "Please limit your response to only a few sentences."
|
| 179 |
-
system_message = "Be creative and imprecise with your word choice. Please limit your respone to only a few sentences."
|
| 180 |
#Function to generate chatbot responses
|
| 181 |
|
| 182 |
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
load_dotenv()
|
|
|
|
| 14 |
|
| 15 |
"""
|
| 16 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
|
|
|
| 131 |
except Exception as e:
|
| 132 |
return f"Error: {str(e)}"
|
| 133 |
|
| 134 |
+
lyric_response = artist_response(gemma_response, artist)
|
| 135 |
+
|
| 136 |
history.append({"role": "user", "content": user_input})
|
| 137 |
+
history.append({"role": "assistant", "content": lyric_response})
|
| 138 |
|
|
|
|
| 139 |
#if artist == "Google Gemma":
|
| 140 |
# lyric_response = gemma_response
|
| 141 |
return lyric_response
|
| 142 |
|
| 143 |
+
HF_API_KEY = os.environ["HF_API_KEY"]
|
| 144 |
+
|
| 145 |
radiohead_lyrics = load_lyrics("radiohead_lyrics.txt")
|
| 146 |
kendrick_lyrics = load_lyrics("kendrick_lamar_lyrics.txt")
|
| 147 |
grateful_dead_lyrics = load_lyrics('grateful_dead_lyrics.txt')
|
|
|
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
+
size = 225 #256
|
| 175 |
|
| 176 |
# Initialize Hugging Face Inference Client
|
| 177 |
client = InferenceClient(#provider="hf-inference",
|
| 178 |
token=HF_API_KEY)
|
| 179 |
|
| 180 |
#system_message = "Please limit your response to only a few sentences."
|
| 181 |
+
system_message = "Be creative and imprecise with your word choice. And don't be too repetitive. Please limit your respone to only a few sentences."
|
| 182 |
#Function to generate chatbot responses
|
| 183 |
|
| 184 |
|