File size: 4,191 Bytes
bbcc5b2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import requests

# Define the image URL
image_url = "https://utfs.io/f/47589c6c-6ce0-4baf-b75d-b1ec5d4d9dda-213j1w.jpg"
audio_url = "https://utfs.io/f/b84a84a2-b68f-49c5-8b7c-d76d894f6d3a-c5qjj4.wav"
video_url = "https://utfs.io/f/ef6c037f-fa61-471a-8956-562bc2d62531-fzxs1i.mp4"
family_url = "https://i.pinimg.com/originals/b2/20/14/b22014ca275e94097386aab222469caf.jpg"


# Define the URLs of the three nodes
extract_text_url = "http://127.0.0.1:5000/extractText"
extract_audio_text_url = "http://127.0.0.1:5000/extractAudioText"
get_image_embedding_url = "http://127.0.0.1:5000/getImageEmbedding"
get_text_embedding_url = "http://127.0.0.1:5000/getTextEmbedding"
get_text_description_embedding_url  = "http://127.0.0.1:5000/getTextDescriptionEmbedding"
get_audio_embedding_url = "http://127.0.0.1:5000/getAudioEmbedding"
get_audio_extracted_text_url = "http://127.0.0.1:5000/getAudioExtractedText"
get_video_embedding_url = "http://127.0.0.1:5000/getVideoEmbedding"
get_object_detection_url = "http://127.0.0.1:5000/detectObjects"
get_similarity_score_url = "http://127.0.0.1:5000/getSimilarityScore"
get_face_locations_url = "http://127.0.0.1:5000/getFaceLocations"

# Make requests to each node with the image URL
try:
    list=[]

    response_text = requests.post(extract_audio_text_url, json={"audio_url": audio_url})
    extracted_text = response_text.json()["transcription"]
    list.append({"length of text":len(extracted_text)})

    # # Request to extract text
    # response_text = requests.post(extract_text_url, json={"imageUrl": image_url})
    # extracted_text = response_text.json().get("extracted_text")
    # list.append({"length of text":len(extracted_text)})

    # # Request to get image embedding
    # response_image_embedding = requests.post(get_image_embedding_url, json={"imageUrl": image_url})
    # image_embedding = response_image_embedding.json().get("image_embedding")
    # list.append({"length of image_embedding":len(image_embedding)})

    # # Request to get text embedding
    # response_text_embedding = requests.post(get_text_embedding_url, json={"text": extracted_text})
    # text_embedding = response_text_embedding.json().get("text_embedding")
    # list.append({"length of text_embedding":len(text_embedding)})

    # # Request to get text description embedding
    # response_text_description_embedding = requests.post(get_text_description_embedding_url, json={"text": "a image of mobile phone"})
    # text_description_embedding = response_text_description_embedding.json().get("text_description_embedding")
    # list.append({"length of text_description_embedding":len(text_description_embedding)})

    # # Request to get audio embedding
    # response_audio_embedding = requests.post(get_audio_embedding_url, json={"audioUrl": audio_url})
    # audio_embedding = response_audio_embedding.json().get("audio_embedding")
    # list.append({"length of audio_embedding":len(audio_embedding)})

    # Request to get video embedding
    response_video_embedding = requests.post(get_video_embedding_url, json={"videoUrl": video_url})
    video_embedding = response_video_embedding.json().get("video_embedding")
    list.append({"length of video_embedding":(video_embedding)})

    # # Request to get object detection
    # response_object_detection = requests.post(get_object_detection_url, json={"imageUrl": image_url})
    # object_detection = response_object_detection.json().get("object_detection_results")
    # list.append({"length of object_detection":len(object_detection)})

    # # Request to get similarity score
    # response_similarity_score = requests.post(get_similarity_score_url, json={"embedding1": text_description_embedding, "embedding2": image_embedding})
    # similarity_score = response_similarity_score.json().get("similarity_score")
    # list.append({"similarity_score":similarity_score})

    # # Request to get face locations
    # response_face_locations = requests.post(get_face_locations_url, json={"imageUrl": family_url})
    # face_locations = response_face_locations.json().get("face_locations")
    # list.append({"face_locations":face_locations})
    print(list)
except Exception as e:
    print("Error:", e)