janasumit2911 commited on
Commit
baf681e
·
verified ·
1 Parent(s): 6b5077f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -92,6 +92,15 @@ def get_audio_data(url):
92
  response.raise_for_status()
93
  return response.content
94
 
 
 
 
 
 
 
 
 
 
95
  def process_audio(params):
96
  try:
97
  params = json.loads(params)
@@ -117,9 +126,9 @@ def process_audio(params):
117
  solutions.append(result)
118
 
119
  result_url = f"{api}/{job_id}"
120
- response = requests.patch(result_url, json={"solutions": solutions})
121
 
122
- return {"solutions": solutions}
123
 
124
  import gradio as gr
125
 
 
92
  response.raise_for_status()
93
  return response.content
94
 
95
+ def send_results_to_api(data, result_url):
96
+ # Example function to send results to an API
97
+ headers = {"Content-Type": "application/json"}
98
+ response = requests.post(result_url, json=data, headers=headers)
99
+ if response.status_code == 200:
100
+ return response.json() # Return any response from the API if needed
101
+ else:
102
+ return {"error": f"Failed to send results to API: {response.status_code}"}
103
+
104
  def process_audio(params):
105
  try:
106
  params = json.loads(params)
 
126
  solutions.append(result)
127
 
128
  result_url = f"{api}/{job_id}"
129
+ # send_results_to_api(solutions, result_url)
130
 
131
+ return json.dumps({"solutions": solutions}, indent=4)
132
 
133
  import gradio as gr
134