Spaces:
Paused
Paused
Add Weave
Browse files- app.py +7 -0
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -23,6 +23,7 @@ from langchain_text_splitters import RecursiveCharacterTextSplitter
|
|
| 23 |
from langchain_core.vectorstores import VectorStoreRetriever
|
| 24 |
|
| 25 |
import time
|
|
|
|
| 26 |
|
| 27 |
from str2escaped import str2escaped
|
| 28 |
|
|
@@ -441,6 +442,7 @@ def get_json(text: str):
|
|
| 441 |
return json.loads(text)
|
| 442 |
|
| 443 |
|
|
|
|
| 444 |
def detect_features(image_paths, garment_type, language="English"):
|
| 445 |
# Path to your image
|
| 446 |
# image_path = "path_to_your_image.jpg"
|
|
@@ -517,6 +519,7 @@ def parse_structure(struct_ref):
|
|
| 517 |
return types, languages
|
| 518 |
|
| 519 |
|
|
|
|
| 520 |
def detect_language(texts, model):
|
| 521 |
langs = ["_"] * len(texts)
|
| 522 |
|
|
@@ -640,6 +643,7 @@ def evaluate(descriptions,
|
|
| 640 |
return response
|
| 641 |
|
| 642 |
|
|
|
|
| 643 |
def generate(*data):
|
| 644 |
global visible
|
| 645 |
print("visible", visible)
|
|
@@ -901,6 +905,9 @@ def authf(username, password):
|
|
| 901 |
|
| 902 |
if __name__ == '__main__':
|
| 903 |
# demo.launch(server_name="0.0.0.0", auth=authf)
|
|
|
|
|
|
|
|
|
|
| 904 |
with open("formatted_prompts.txt", "w") as f:
|
| 905 |
f.writelines('"write_struct_copy": "' + str2escaped(struct_copy_prompt).strip() + '",\n')
|
| 906 |
f.writelines('"write_copy": "' + str2escaped(copy_prompt).strip() + '",\n')
|
|
|
|
| 23 |
from langchain_core.vectorstores import VectorStoreRetriever
|
| 24 |
|
| 25 |
import time
|
| 26 |
+
import weave
|
| 27 |
|
| 28 |
from str2escaped import str2escaped
|
| 29 |
|
|
|
|
| 442 |
return json.loads(text)
|
| 443 |
|
| 444 |
|
| 445 |
+
@weave.op
|
| 446 |
def detect_features(image_paths, garment_type, language="English"):
|
| 447 |
# Path to your image
|
| 448 |
# image_path = "path_to_your_image.jpg"
|
|
|
|
| 519 |
return types, languages
|
| 520 |
|
| 521 |
|
| 522 |
+
@weave.op
|
| 523 |
def detect_language(texts, model):
|
| 524 |
langs = ["_"] * len(texts)
|
| 525 |
|
|
|
|
| 643 |
return response
|
| 644 |
|
| 645 |
|
| 646 |
+
@weave.op
|
| 647 |
def generate(*data):
|
| 648 |
global visible
|
| 649 |
print("visible", visible)
|
|
|
|
| 905 |
|
| 906 |
if __name__ == '__main__':
|
| 907 |
# demo.launch(server_name="0.0.0.0", auth=authf)
|
| 908 |
+
|
| 909 |
+
weave.init("Copywriting - Hugging Face")
|
| 910 |
+
|
| 911 |
with open("formatted_prompts.txt", "w") as f:
|
| 912 |
f.writelines('"write_struct_copy": "' + str2escaped(struct_copy_prompt).strip() + '",\n')
|
| 913 |
f.writelines('"write_copy": "' + str2escaped(copy_prompt).strip() + '",\n')
|
requirements.txt
CHANGED
|
@@ -9,4 +9,5 @@ langchain_chroma
|
|
| 9 |
langchainhub
|
| 10 |
langchain_community
|
| 11 |
langchain-google-genai
|
| 12 |
-
google-generativeai
|
|
|
|
|
|
| 9 |
langchainhub
|
| 10 |
langchain_community
|
| 11 |
langchain-google-genai
|
| 12 |
+
google-generativeai
|
| 13 |
+
weave
|