Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -104,12 +104,12 @@ def getPrompt(prompt, modelID, attempts=1):
|
|
104 |
else:
|
105 |
apiData={"inputs":prompt, "parameters": parameters, "options": options, "timeout": 45}
|
106 |
response = requests.post(API_URL + modelID, headers=headers, data=json.dumps(apiData))
|
|
|
107 |
except Exception as e:
|
108 |
print(f"An error occurred: {e}")
|
109 |
if attempts < 3:
|
110 |
getPrompt(prompt, modelID, attempts + 1)
|
111 |
-
|
112 |
-
return response.json()
|
113 |
|
114 |
@app.post("/inferencePrompt")
|
115 |
def inferencePrompt(item: Core):
|
|
|
104 |
else:
|
105 |
apiData={"inputs":prompt, "parameters": parameters, "options": options, "timeout": 45}
|
106 |
response = requests.post(API_URL + modelID, headers=headers, data=json.dumps(apiData))
|
107 |
+
return response.json()
|
108 |
except Exception as e:
|
109 |
print(f"An error occurred: {e}")
|
110 |
if attempts < 3:
|
111 |
getPrompt(prompt, modelID, attempts + 1)
|
112 |
+
return response
|
|
|
113 |
|
114 |
@app.post("/inferencePrompt")
|
115 |
def inferencePrompt(item: Core):
|