cetinca commited on
Commit
17f6802
·
verified ·
1 Parent(s): 05b4410

Update api name

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. test_api.py +5 -4
app.py CHANGED
@@ -204,7 +204,7 @@ with gr.Blocks() as html_block:
204
  fn=try_text2int_preprocessed,
205
  inputs=inputs_text2int_preprocessed,
206
  outputs=outputs_text2int_preprocessed,
207
- api_name="text2int_preprocessed",
208
  )
209
 
210
  examples_text2int_preprocessed = [
@@ -221,14 +221,14 @@ with gr.Blocks() as html_block:
221
  import requests
222
 
223
  requests.post(
224
- url="https://tangibleai-mathtext.hf.space/run/text2int_preprocessed", json={"data": ["one hundred forty five"]}
225
  ).json()
226
  ```
227
 
228
  Or using `curl`:
229
 
230
  ```bash
231
- curl -X POST https://tangibleai-mathtext.hf.space/run/text2int_preprocessed -H 'Content-Type: application/json' -d '{"data": ["one hundred forty five"]}'
232
  ```
233
  {bq_json}""" + f"{json.loads(BQ_JSON)['type']}")
234
 
 
204
  fn=try_text2int_preprocessed,
205
  inputs=inputs_text2int_preprocessed,
206
  outputs=outputs_text2int_preprocessed,
207
+ api_name="text2int-preprocessed",
208
  )
209
 
210
  examples_text2int_preprocessed = [
 
221
  import requests
222
 
223
  requests.post(
224
+ url="https://tangibleai-mathtext.hf.space/run/text2int-preprocessed", json={"data": ["one hundred forty five"]}
225
  ).json()
226
  ```
227
 
228
  Or using `curl`:
229
 
230
  ```bash
231
+ curl -X POST https://tangibleai-mathtext.hf.space/run/text2int-preprocessed -H 'Content-Type: application/json' -d '{"data": ["one hundred forty five"]}'
232
  ```
233
  {bq_json}""" + f"{json.loads(BQ_JSON)['type']}")
234
 
test_api.py CHANGED
@@ -7,12 +7,12 @@ import pandas as pd
7
  import httpx
8
  from os.path import exists
9
 
10
- NUMBER_OF_CALLS = 10
11
 
12
  headers = {"Content-Type": "application/json; charset=utf-8"}
13
 
14
- base_url = "https://tangibleai-mathtext.hf.space/run/{endpoint}"
15
- # base_url = "http://localhost:7860/run/{endpoint}"
16
 
17
  data_list_1 = {
18
  "endpoint": "text2int",
@@ -26,7 +26,7 @@ data_list_1 = {
26
  }
27
 
28
  data_list_2 = {
29
- "endpoint": "text2int_preprocessed",
30
  "test_data": [
31
  "one hundred forty five",
32
  "twenty thousand nine hundred fifty",
@@ -57,6 +57,7 @@ async def call_api(url, data, call_number, number_of_calls):
57
  return {
58
  "endpoint": url.split("/")[-1],
59
  "test data": data,
 
60
  "response": response.json().get("data"),
61
  "call number": call_number,
62
  "number of calls": number_of_calls,
 
7
  import httpx
8
  from os.path import exists
9
 
10
+ NUMBER_OF_CALLS = 20
11
 
12
  headers = {"Content-Type": "application/json; charset=utf-8"}
13
 
14
+ # base_url = "https://tangibleai-mathtext.hf.space/run/{endpoint}"
15
+ base_url = "http://localhost:7860/run/{endpoint}"
16
 
17
  data_list_1 = {
18
  "endpoint": "text2int",
 
26
  }
27
 
28
  data_list_2 = {
29
+ "endpoint": "text2int-preprocessed",
30
  "test_data": [
31
  "one hundred forty five",
32
  "twenty thousand nine hundred fifty",
 
57
  return {
58
  "endpoint": url.split("/")[-1],
59
  "test data": data,
60
+ "status code": response.status_code,
61
  "response": response.json().get("data"),
62
  "call number": call_number,
63
  "number of calls": number_of_calls,