cetinca commited on
Commit
5f4f624
·
verified ·
1 Parent(s): 7382912

Update interface

Browse files
Files changed (2) hide show
  1. app.py +9 -8
  2. mathtext-nlu-api.py +18 -0
app.py CHANGED
@@ -172,11 +172,12 @@ curl -X POST https://Hobson-gradio-rest-api.hf.space/api/predict/ -H 'Content-Ty
172
  ```
173
  """ + f"{json.loads(BQ_JSON)['type']}")
174
 
175
- interface = gr.Interface(lambda: None, inputs=[textbox_input], outputs=[textbox_output])
176
-
177
- html_block.input_components = interface.input_components
178
- html_block.output_components = interface.output_components
179
- html_block.examples = None
180
- html_block.predict_durations = []
181
-
182
- bapp = html_block.launch()
 
 
172
  ```
173
  """ + f"{json.loads(BQ_JSON)['type']}")
174
 
175
+ # interface = gr.Interface(lambda: None, inputs=[textbox_input], outputs=[textbox_output])
176
+ interface = gr.Interface(fn=try_text2int_preprocessed, inputs=[textbox_input], outputs=[textbox_output])
177
+
178
+ # html_block.input_components = interface.input_components
179
+ # html_block.output_components = interface.output_components
180
+ # html_block.examples = None
181
+ # html_block.predict_durations = []
182
+ #
183
+ # bapp = html_block.launch()
mathtext-nlu-api.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import requests
4
+
5
+ load_dotenv()
6
+
7
+ # data = input("Enter a number as text:\n").split()
8
+ data = "four two".split()
9
+
10
+ HUG_ACC_TOKEN = os.environ.get("HUG_ACC_TOKEN")
11
+
12
+ response = requests.post(
13
+ url="https://cetinca-mathtext-nlu.hf.space/run/predict",
14
+ json={"data": data, "fn_index": 0},
15
+ # headers={'Authorization': HUG_ACC_TOKEN},
16
+ )
17
+
18
+ print(response.status_code)