Thomas Richardson commited on
Commit
35ac490
·
1 Parent(s): 81ed61c

feature(#86): comment gradio due to hugging face old version

Browse files
Files changed (2) hide show
  1. Brain/src/gradio_debug.py +46 -46
  2. app.py +5 -5
Brain/src/gradio_debug.py CHANGED
@@ -1,47 +1,47 @@
1
  """gradio implementaion"""
2
- import gradio as gr
3
- import requests
4
- import json
5
- from gradio.components import Textbox, Number
6
-
7
- DEFAULT_UUID = "c40a09075d11940f"
8
-
9
-
10
- def gradio_send_notification(uuid: str, query: str):
11
- url = "http://localhost:7860/sendNotification"
12
- data = {
13
- "confs": {
14
- "openai_key": "",
15
- "pinecone_key": "",
16
- "pinecone_env": "",
17
- "firebase_key": "",
18
- "settings": {"temperature": 0.6},
19
- "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
20
- "uuid": uuid,
21
- },
22
- "message": query,
23
- }
24
-
25
- response = requests.post(
26
- url, data=json.dumps(data), headers={"Content-Type": "application/json"}
27
- )
28
- response = response.json()
29
- return json.dumps(response["result"]), response["status_code"]
30
-
31
-
32
- debug_send_notification = gr.Interface(
33
- fn=gradio_send_notification,
34
- inputs=[
35
- Textbox(
36
- label="UUID",
37
- placeholder="Please input your UUID.",
38
- value="c40a09075d11940f",
39
- ),
40
- Textbox(label="query", placeholder="Please input your prompt."),
41
- ],
42
- outputs=[
43
- Textbox(label="Result"),
44
- Number(label="Status Code"),
45
- ],
46
- allow_flagging="never",
47
- )
 
1
  """gradio implementaion"""
2
+ # import gradio as gr
3
+ # import requests
4
+ # import json
5
+ # from gradio.components import Textbox, Number
6
+ #
7
+ # DEFAULT_UUID = "c40a09075d11940f"
8
+ #
9
+ #
10
+ # def gradio_send_notification(uuid: str, query: str):
11
+ # url = "http://localhost:7860/sendNotification"
12
+ # data = {
13
+ # "confs": {
14
+ # "openai_key": "",
15
+ # "pinecone_key": "",
16
+ # "pinecone_env": "",
17
+ # "firebase_key": "",
18
+ # "settings": {"temperature": 0.6},
19
+ # "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
20
+ # "uuid": uuid,
21
+ # },
22
+ # "message": query,
23
+ # }
24
+ #
25
+ # response = requests.post(
26
+ # url, data=json.dumps(data), headers={"Content-Type": "application/json"}
27
+ # )
28
+ # response = response.json()
29
+ # return json.dumps(response["result"]), response["status_code"]
30
+ #
31
+ #
32
+ # debug_send_notification = gr.Interface(
33
+ # fn=gradio_send_notification,
34
+ # inputs=[
35
+ # Textbox(
36
+ # label="UUID",
37
+ # placeholder="Please input your UUID.",
38
+ # value="c40a09075d11940f",
39
+ # ),
40
+ # Textbox(label="query", placeholder="Please input your prompt."),
41
+ # ],
42
+ # outputs=[
43
+ # Textbox(label="Result"),
44
+ # Number(label="Status Code"),
45
+ # ],
46
+ # allow_flagging="never",
47
+ # )
app.py CHANGED
@@ -32,11 +32,11 @@ app.include_router(construct_blueprint_train_api(), prefix="/train", tags=["ai_t
32
 
33
  # gradio
34
 
35
- CUSTOM_PATH = "/gradio"
36
-
37
- app = gr.mount_gradio_app(
38
- app, debug_send_notification, path=f"{CUSTOM_PATH}/sendNotification"
39
- )
40
 
41
  if __name__ == "__main__":
42
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
32
 
33
  # gradio
34
 
35
+ # CUSTOM_PATH = "/gradio"
36
+ #
37
+ # app = gr.mount_gradio_app(
38
+ # app, debug_send_notification, path=f"{CUSTOM_PATH}/sendNotification"
39
+ # )
40
 
41
  if __name__ == "__main__":
42
  uvicorn.run(app, host="0.0.0.0", port=7860)