YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

import os import requests import re import json

Define the API key and endpoint

apiKey = "d5eccb08-002a-4d34-aad6-8834a8692caf"

def query_api(usersInputObj): inputsArray = [ {"id": "{input_1}", "label": "Enter query", "type": "text"}, {"id": "{input_2}", "label": "Upload a pdf file", "type": "file"} ]

prompt = "Answer this query {input_1} from this pdf file url {input_2}"
filesData, textData = {}, {}

for inputObj in inputsArray:
    inputId = inputObj['id']
    if inputObj['type'] == 'text':
        prompt = prompt.replace(inputId, usersInputObj[inputId])
    elif inputObj['type'] == 'file':
        path = usersInputObj[inputId]
        file_name = os.path.basename(path)
        f = open(path, 'rb')
        filesData[inputId] = f

textData['details'] = json.dumps({
    'appname': 'pdf ai query answerer',
    'prompt': prompt,
    'documentId': 'no-embd-type',
    'appId': '66c8aae064d827b744a2a12d',
    'memoryId': '',
    'apiKey': apiKey
})

response = requests.post('https://apiappstore.guvi.ai/api/output', data=textData, files=filesData)
output = response.json()

# Close the file after use
if filesData:
    for file in filesData.values():
        file.close()

return output['output']

def predict(inputs): # Prepare the input object for API usersInputObj = { '{input_1}': inputs.get("input_1", ""), '{input_2}': inputs.get("input_2", "") }

# Call the query API function
output = query_api(usersInputObj)

# Replace the localhost URL with the correct one
url_regex = r'http://localhost:7000/'
replaced_string = re.sub(url_regex, 'https://apiappstore.guvi.ai/', output)

# Return the final output
return {"output": replaced_string}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support